WordPress has a handy little function called the_category()
which outputs a link to the current post category in the loop. Unfortunately it adds a rel
tag that breaks HTML5 validation. Here’s a quick fix for your theme’s functions.php
.
To stop WordPress from adding rel="category tag"
to your category links, just edit your theme’s functions.php
file and add the following code:
1 2 3 4 5 | add_filter('the_category', 'remove_category_rel'); function remove_category_rel($string) { return str_replace('rel="category tag"', '', $string); } |
The above function just replaces the rel attribute with… nothing. Proceed with HTML5 validation.