Horje
Remove URL from blogroll links - Wordpress Solution
[Solved] - Remove URL from blogroll links - Wordpress Solution
Try following codes
Hi, I have a blogroll with a list of links. I would like to 'unlink' some of them and just display plain text but WP won't let you do that as it 'needs' to have at least a # sign in the 'Web Address' field. I would like to have some links pointing to real URLs and other bookmarks to not be linked to any URL at all. Is there a way to remove this requirement and have WP turn the bookmarks that have a URL into actual links and bookmarks that don't have a URL in plain text? Thanks!

Solution - 1

Open wp-admin/includes/bookmark-template.php Find

$output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>';
Replace with
$output .= $the_link == '#' ? $title : ('<a href="' . $the_link . '"' . $rel . $title . $target . '>'); 
Now if you add a link with href = #, it'll be printed as plain text. I couldn't think of any solution without modifying the core yet. Will try.


Solution - 2

It might be easier to just use the Text widget and supply your own links for the ones that need them and not for those that don't... Lew


Solution - 3

If you want to use WordPress blogroll display (widget), you can't do that, not without writing functions that are creating links. I checked them out (wp_list_bookmarks is used and _walk_bookmarks), and the A tag is always display for each link. There is no filters or actions in these functions to hook into them and changes this, and only thing that can be done is to replace _walk_bookmarks function with another one that will make the distinction you need for displaying linked and not linked bookmarks.

Date: 2022-10-21 05:22:46
Category: Wordpress
More for You