Fixing html 5 validation errors on a self hosted wordpress blog

So it was bout a month ago when suddenly the validator at decided that it was going to be picky about the values in the “rel” attribute. Although i fixed this for grigorig back then i didn’t have time to write a post at the time, what with exams happening etc, but with the latest update to WordPress overwriting some files i decided to make sure i catalog the events and tell you, our 2 or 3 readers where to edit what files. Incidentally as i type this i’m making my way through a bowl of vanilla ice cream with a broken up crunchy bar mixed in, delicious. for best results on the crumbling a crunchy bar just twist it inside the packaging from the end and let it fall in the ice cream.

Anyhoo, the html 5 wordpress fixes. You will need an ftp client like filezilla and a text editor that has the option to save files without the BOM (byte order mark). So if you are on windows i suggest notepad++ from and read up on the post about bom from an earlier post here.
Non windows should be OK, i’m using coda on the mac which does the job of ftp and text editing 🙂

First in the root of the WordPress installation go to wp-includes directory and find the file category-template.php and around line 163 you should see ‘rel=”category tag”‘ : ‘rel=”category”‘
delete just the word category, you can leave tag, and leave the other one blank, this should reduce the majority of errors.

The final few are in default-filters.php which is also in the wp-includes directory

Johan writes in the comments that the correct way to do the things i outline below is to remove them with some code in the themes functions.php instead of the core files, like the default-filters.php, it is at this point i should point out that i’m no expert, just a student about to graduate and be unemployed, so more of a bumbling baffoon if you will, anyway Johan writes “Editing WP core is NOT the way to do this as any changes will be reverted at the next update. Instead, use your theme’s functions.php

remove_action(‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0);
remove_action(‘wp_head’, ‘start_post_rel_link’, 10, 0 );
it means this: remove_action( $tag, $function_to_add, $priority, $accepted_args );
$tag being the hook, some of the functions to remove might not need the last argument, see hollywoodgrind’s post here

Edit some of the add_action function calls by commenting them out, specifically those with rel link in them, the majority are under //actions at line 200
i’ve removed rsd_link, index_rel_link, parent_post_rel_link, start_post_rel_link, rel_canonical and wp_shortlink_wp_head. At one point i also had wlwmanifest_link commented out but have since left it active until i find where i thought it was invalid.

There’s another under // Misc filters called wp_rel_nofollow at around line 188

The rest of the fixes i’ve found were in the theme, i’m using the twenty-ten theme which came as default with WordPress when i installed

You may or may not have these, but they can be found in attachment.php, loop-attachment.php and footer.php
in attachemnt.php around line 18 should be rel=”gallery”. Delete just the rel=”gallery”

similarly in loop-attachment.php around lines 88 and 99 find rel=”attachment” and delete it from both lines

finally in footer.php around line 26 there’s rel=”home” which is invalid so delete that, and around line 34 is rel=”generator” also invalid so delete that too.

One last thing, some new and older posts may have rel=”attachment” still in the html of the post, usually in the src tag when inserting images, remove this from the html of the post from the editor.

That was all i found at the time, which seems to cover the main page, the single pages, archives, about page etc.

There’s a chance that some of you may have plugins installed that give errors, i’m afraid you’ll have to look elsewhere for fixes on that as i don’t have any problematic ones to give advice on. Sorry

The errors pertaining to this post are:
Bad value attachment wp-att-1509 for attribute rel on element a: Keyword attachment is not registered.

Bad value EditURI for attribute rel on element link: Keyword edituri is not registered.

…plication/rsd+xml” title=”RSD” href=”” />

Bad value wlwmanifest for attribute rel on element link: Keyword wlwmanifest is not registered.

…wlwmanifest+xml” href=”” />

Bad value index for attribute rel on element link: Keyword index is not registered.

Bad value canonical for attribute rel on element link: Keyword canonical is not registered.

//these next 2 are in the single page

Bad value start for attribute rel on element link: Keyword start is not registered.

…rel=’start’ title=’Hello world!’ href=’’ />

Bad value shortlink for attribute rel on element link: Keyword shortlink is not registered.


the rest are theme specific

gallary found in attachment.php line 18 ish

Bad value gallary for attribute rel on element a: Keyword gallary is not registered.

…mbat – The Review” rel=”gallary”> Mo

This entry was posted in General, lartens, Quirks, Tech and tagged , , , , , , , , , , , , , . Bookmark the permalink.

Recent Posts

4 Responses to Fixing html 5 validation errors on a self hosted wordpress blog

Leave a Reply

Your email address will not be published.