• How would I make the sidebar links for Categories and Archives nofollow? There does not seem to be a plugin that will do this.

Viewing 5 replies - 1 through 5 (of 5 total)
  • My “really old” plugin can still take care of this (as long as you’re not using sidebar widgets):

    https://guff.szub.net/2005/01/27/add-link-attribute/

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    add_filter('wp_list_categories','wp_rel_nofollow'); will do the trick easily enough for the categories.

    There’s no filter on the wp_get_archives function that I can find though.

    Bah! You and your crazy filters! ;)

    (Where have I read that before…)

    Let me share a personal quote from earlier this year with everyone:

    Dammit, everything in WordPress should have a filter by now. Everything!!!

    If that came true, I could stop linking to hacky plugins of mine written all the way back in 2005.

    Thread Starter twdblog

    (@twdblog)

    I’m using sidebar widgets.

    I put the categories filter in the default-filters.php file, but it did not work. Does it go somewhere else?

    The wp_rel_nofollow() filter appears to be broken in 2.5.1 — when I add the suggested line to default-filters.php, the category list rendered on my site’s homepage has escaped quotes:

    <li class=\"cat-item cat-item-3\"><a href=\"https://example.com/foo\" title=\"View all posts filed under Colophon\" rel=\"nofollow\">Colophon</a> (10)

    I worked around this bug by cloning the wp_rel_nofollow() function to a new name and removing this line from it:
    $text = $wpdb->escape($text);
    and then updating default-filters.php with my new function name:
    add_filter('wp_list_categories','wp_rel_nofollow_mgm');

    Voila! Category links are nofollowed and there are no ugly escaped-quote issues in the source.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘NOFOLLOW in Category and Archive Sidebar links’ is closed to new replies.