Make rel=publisher Passed W3 Validator

rel=publisher is a HTML piece that makes Google recognize (by rich snippet parser) the publisher of current page in search result. Unfortunately, the common implementation of rel=publisher by <link> tag is not validated by W3 Validator. Although W3 validator is just a guide and we don’t have to follow 100%, but we should if we can. This post shows a simple solution to make rel=publisher become valid.

rel=publisher validation

First, you need to remove <link rel="publisher" ...> tag in the header. In WordPress, if you added manually you’ll find it in header.php file of your theme. If you added using WordPress SEO plugin, remove it from SEO > Social > tab Google+ > box “Google Publisher Page:”.

Now you add this line into anywhere of your page, but not in <head> section:

<a href="https://plus.google.com/YOUR-GOOGLE-ID?rel=publisher">Google+</a>

Change YOUR-GOOGLE-ID to your google publisher page ID.

In WordPress, a good practice is adding to footer via hook wp_footer. Add the following code into functions.php file of your theme:

add_action( 'wp_footer', 'myprefix_google_publisher' );
function myprefix_google_publisher()
{
    echo '<a href="https://plus.google.com/YOUR-GOOGLE-ID?rel=publisher">Google+</a>';
}

This is tested by Google Rich Snippet Tool. Enjoy!

CategoriesSEO

2 thoughts on “Make rel=publisher Passed W3 Validator

Comments are closed.

Newsletter

Subscribe to our newsletter to receive news and tutorials about WordPress and web development.

Want to get away from Pipdig drama? See 30+ Pipdig blog themes alternatives See here →