0

I added a filter to my widget titles and it looks like the filter doesn't apply on links, which are created with the links-sidebar. It does work perfectly on the blogroll or search widget

Here's a Screenshot, to illustrate what I mean.

add_filter('widget_title', 'new_title', 99);
function new_title($title) {
    $title = 'text';
    return $title;
}

I disabled all plugins and tried the same the default wordpress themes and got the same results.

1
  • What is the "links sidebar" that used to create that?
    – kaiser
    Jun 4, 2014 at 14:38

1 Answer 1

0

The "Links" widget uses wp_list_bookmarks, which outputs a nested list similar to:

<li>
    <h2>[category]</h2>
    <ul class="xoxo blogroll">
         [links]
    </ul>
</li>

You can override [category] using the link_category filter:

function wpse_147543_link_category( $title ) {
    $title = 'title';
    return $title;
}

add_filter( 'link_category', 'wpse_147543_link_category' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.