add_filter( 'the_category', 'add_nofollow_cat' ); function add_nofollow_cat( $text ) { $text = str_replace('rel="category tag"', "", $text); return $text; }
Now the W3 Validator has one less WordPress quirk to pickup on.
© 2011 Whitney Krape
Quick fix for rel=”category tag” in WordPress
Here is a quick tip for helping WordPress, WordPress 3.2 specifically, with the HTML5 spec. HTML5 spec says that only certain rel types are allowed and WordPress’ “category tag” isn’t one of them. Fortunately I found a good bit of code here http://smalldiary.com/wordpresshow-to-add-nofollow-to-category-links.html which strips out the current rel=”category tag” and adds a rel=”nofollow” as a filter in the fuctions.php file for the theme. By adding it to the functions.php for the theme this provides a theme wide fix rather than having to edit individual templates.
I altered the code a bit for my uses, however, as I’d still like the search engines crawling around my site so I stripped the code down to:
Pingback: Building a WP Site: SEO | jrConway Programming
Pingback: Artikelsystem online | DE-Homepage-erstellen Aktuelle Artikel und Beiträge
Pingback: WP-Trick: Twenty Twelve nun W3C-Valide | Technokrat
Pingback: ROBPRESS | Category tag-Fix
Pingback: Come risolvere il problema rel=”category tag” in WordPress | WPAOT - Wordpress, Web Design, Web Marketing, CSS
Pingback: 快速解决wordpress不能通过W3C验证的问题 | 75工坊
Pingback: 10 HTML5 Validation Errors and How to Fix Them | Creative Whim
Pingback: HTML5, CSS3, JavaScript i inne nowości web 2.0 – chemikpil.pl » Niepoprawny kod Wordpressa? Naprawa atrybutu rel.