WordPress Validation Error For Category Tags

Got around to validating this blog with the W3C Validator, and discovered there were 19 errors involving the category links.

Apparently, WordPress sets up these links with a rel="category tag" attribute, which doesn’t pass validation.

Ispire.me has the fix for this error, which is repeated here for my own future reference:

  1. Go to the /wordpress/wp-includes/ directory.
  2. Find the category-template.php file. Make a copy, and call it category-template-original.php.
  3. Edit the category-template.php file with Notepad++.
  4. Find line 163, which reads:
    $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
  5. Edit the part of the line which says: rel="category tag" to rel="tag". The line should now read:
    $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="tag"' : 'rel="category"';
  6. Save category-template.php and upload it to /wordpress/wp-includes/.
  7. Repeat steps 1-6 each time WordPress version updates are installed.

The code in Step 5 is word-wrapped. If copying & pasting, do NOT add returns to this code!

This entry was posted in HTML & CSS, WordPress, WordPress - Validation. Bookmark the permalink.