If you want to get rid of the rel attributes that cause the html5 validation to fail. There is some difference of opinion around this.
- the w3 group dropped some of the rel attributes
- html5 not final? so why drop what might be good to have in?
- just because the validitor does not have them doesn’t mean your code is bad
BUT,
- your client may not understand – the site must be html5 AND valid!
- I miss that green 100% valid reassurance when I am testing although I like to test with default wordpress and default theme… what to do?
If you want that green 100% valid response back, regardless, then……
Remove the rel attributes to get the green back
A bunch of actions and filters and yes, you have to use a child theme with own header and footer unfortunately as some is hardcoded in the header.php
Add to child theme functions.php or a temporary plugin:
remove_action( 'wp_head', 'index_rel_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head','adjacent_posts_rel_link_wp_head');
remove_action('wp_head','start_post_rel_link');
Theme edits
Footer.php
copy to child theme and edit footer.php
- line 26 remove rel=”generator”
Header.php
copy to child theme and edit header.php
- line 48 remove the rel=profile link (not used in html5?)
<link rel="profile" href="http://gmpg.org/xfn/11" />
- line 74 remove rel=”home”
Another option: Replace rel attributes with accepted ones:
The links need a rel attribute, so choose a valid one and replace the invalid ones:
add_filter('parent_post_rel_link', 'amr_remove_rel_up');
function amr_remove_rel_up($link) {
return (str_replace ("rel='up'","rel='xxxxx'", $link));
}
add_filter('next_post_rel_link', 'amr_remove_rel_next');
add_filter('prev_post_rel_link', 'amr_remove_rel_prev');
add_filter('start_post_rel_link', 'amr_remove_rel_start');
add_filter('end_post_rel_link', 'amr_remove_rel_end');
add_filter('index_rel_link', 'amr_remove_rel_index');
etc.....



3 Comments
July 27th, 2011 at 5:31 pm
Hello,
Thanks fo this post.
What’s the solution for rel=”category tag” ?
Regards.
Christophe
August 12th, 2011 at 12:30 pm
Christophe, making it simply
rel="tag"should validate.August 30th, 2011 at 7:48 am
Found : http://www.grigorig.com/fixing-html-5-validation-errors-on-a-self-hosted-wordpress-blog/