WordPress Category Link HTML 5 Validation Errors

When I conducted an HTML5 validation check using W3 Validator for our client’s WordPress website, I eventually found this error

rel category tag
Line 141, Column 114: Bad value category tag for attribute rel on element a: The string category is not a registered keyword or absolute URL.

In HTML5, alt=”rel category tag” attribute is considered as bad value category tag by W3 Validator. So here my solution, I replace the similar line

<p>Categories: <?php the_category(' '); ?></p>


$category = get_the_category();
$separate = ', ';
$output = '';
foreach($category as $cat) {
$output .= '<a href="'.get_category_link( $cat->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $cat->name ) ) . '">'.$cat->cat_name.'</a>'.$separate;
echo trim($output, $separate);

I hope this tweak will also work for you.


Elvin is one of the contributors of mylabplus.com. He has been creating Wordpress Plugins, Magento Extensions, & Mobile Applications. If you find this article useful, please Follow him on .
About Elvin D.
Leave Your Thought