Learn how to use rel=author and rel=me in WordPress to connect your WordPress posts and articles to your Google+ profile using Authorship Markup.

How To Use rel=“author” and rel=“me” in WordPress

Written by in Tutorials |

Google is highlighting content creators in their search results and setting up your WordPress blog to make sure Google pulls and associates all the correct information is a fairly straight forward and simple process. The Authorship markup video above by Matt Cutts and Othar Hansson outlines how to connect content authors with their content using authorship markup but we’ll go over some WordPress specific ways in this post.

Below, you can see how the results look for the post, “Google Gives Authors Greater Recognition in Search Results,” by Mashables Ben Parr:

Google Authors Highlight

Google is Highlighting Authors with a Google+ Image and Profile Link

How It Works: 3 Important Links

In order for Google to correctly associate your blog articles with your Google+ profile you need to have 3 very specific links setup:

  1. A link from your blog post to your WordPress author archive page using rel="author"
  2. A link from your WordPress author archive page to your Google+ profile using rel="me"
  3. A link from you Google+ profile page to your WordPress author archive using rel="me"

Technically you can use any page as your author page as long as it has a link back to your Google+ profile page using rel="me" and it’s not a freely hosted domain such as Blogger or WordPress.com.

Add rel="author" to Blog Posts

This link will tell Google about the authorship of posts, articles and pages on the domain you attach it to. If your WordPress blog has multiple authors, each author will have a link on their posts to their author archive page that lists all post written by that author. That link is where you want to add the rel="author" attribute.

If you are the only author on your blog you don’t have to link to your author archive page, you can link to your about page instead.

The vast majority of WordPress themes list the author of a post in what’s called the byline (usually right below the post title or at the end of the post) and that’s where we want to add rel="author".

Open up your single.php file (or equivalent) and find the byline section. It looks something like this:

<p class="byline">Written by <a class="vcard url fn author" rel="author" href="http://yoursite.com/author/name" title="Posts By Author"><?php the_author(); ?></a></p>

Add rel="author" to Navigation Menu Links

WordPress Screen Options

WordPress Screen Options

As I mentioned, if you’re the only author on your blog, you can add the rel="author" attribute to your “about” page link in your nav menu.

To do this, go to the Menus page in your WordPress admin and click on the Screen Options tab. Then make sure the “Link Relationship (XFN)” option is checked.

WordPress Advanced Options

Check the "Link Relationship (XFN)" box

Then edit your navigation menu to include author for your About page. This will automatically add rel="author" to the link.

WordPress Menus

Add "author" to the <em>Link Relationship (XFN)</em> section.

Add rel="author" to Author Bylines For Thesis Users

If you’re a Thesis theme user, you can open up your custom_functions.php file and add the following code:

function custom_headline_catcher() {
function custom_headline_catcher_end() {
	global $thesis_design;
	if ($thesis_design->display['byline']['author']['nofollow'])
		$output = str_replace( 'rel="nofollow"', 'rel="nofollow author"', ob_get_contents() );
		$output = str_replace( 'class="url fn"', 'class="url fn" rel="author"', ob_get_contents() );
	echo $output;
add_action('thesis_hook_post_box_top', 'custom_headline_catcher');
add_action('thesis_hook_before_post' , 'custom_headline_catcher_end');

This will make sure the rel="author" attribute is added to the author link in the byline. Make sure you have “Show author name in post byline” and “Link author name to archive” selected under Thesis Design Options > Display Options > Bylines.

Using Authorship Markup Using URL Parameters

Google also has a simple method for those not inclined to mess with a lot of code. It basically entails adding ?rel=author to the end of your Google+ profile URL and using your name plus a “+” as your anchor text. Here’s a video by Matt Cutts and Othar Hansson from Google to explain it further:

Allow Authors to Add rel="me" to Links in Their Bio

Unfortunately, WordPress automatically removes all rel attributes from links in the author bio section but Joost de Valk has opened a Trac ticket to change this behavior. In the meantime, he has written some code that can be added to your themes functions.php file to allow the use of rel attributes:

function allow_rel() {
	global $allowedtags;
	$allowedtags['a']['rel'] = array ();
add_action( 'wp_loaded', 'allow_rel' );

Joost wrote a patch but apparently is also allows commentors to add rel attributes to links in comments as well which might not be the best move.

Allow Authors to Enter Their Google+ Profile URL

You can also give authors of your blog the ability to add their Google+ profile URL to their Contact Info within WordPress by adding some user contact info.

Add the following to your themes functions.php file:

function add_google_profile( $contactmethods ) {
	$contactmethods['google_profile'] = 'Google Profile URL';
	return $contactmethods;
add_filter( 'user_contactmethods', 'add_google_profile', 10, 1);

Now you can output that information however you’d like.

You can also link your WordPress author archive page to your Google+ profile by creating a Google +1 button and selecting the “author” option when generating the button code.

Link Author Name to Google+ Profile for Thesis Users

Thesis users can open up their custom_functions.php file add add the following:

function my_archive_intro_headline($output) {
	global $wp_query;
	if (is_author()) {
	$author = $wp_query->query_vars['author'];
	$author_name = get_author_name($author);
	$profile_url = get_the_author_meta('google_profile',$author);
	$output = str_replace($author_name, '<a rel="me" href="' . $profile_url . '">' . $author_name . '</a>',  $output);
return $output;

This will link the authors Google+ profile URL to the author name which appears on the author archive page.

Linking Your Google+ Profile to Your Author Page

The last step is to add a link on your Google+ profile back to the author page (or About page) on your WordPress site.

To do this, go to your Google profile and select Edit Profile. Click on the Links section and choose Add custom link. Enter the URL to your author archive page and make sure “This page is specifically about me” is checked so it adds rel="me" to the link.

Add Link to Google Profile

Add Link to Google Profile.

How To Test Your rel="author" Implementation

We’ve covered everything listed in Google’s Author information in search results article so everything should be setup correctly. However, you can use Google’s Rich Snippets Testing Tool to confirm your site.

This will show you the following if everything is setup correctly:

Google Rich Snippet Testing Tool

You can also submit your site to the Authorship Request Form but it isn’t necessary.

Don’t worry if you see a Warning: Missing required field “updated” or Warning: Missing required hCard “author” message. As long as you see Verified: Authorship markup is correct for this page, you’re fine. Also, when you’re testing your page/post with the Rich Snippets Testing Tool, make sure to add http:// before the URL or you’ll see Error: Google Profile does not link to article site.

Enjoy this post? Consider sharing it: