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() {
	ob_start();
}
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() );
	else
		$output = str_replace( 'class="url fn"', 'class="url fn" rel="author"', ob_get_contents() );
	ob_end_clean();
	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;
}
add_filter('thesis_archive_intro_headline','my_archive_intro_headline');

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:

  • SergeLiatko

    nice one!

    here is my answer for php stuff (preconfigured) http://creersitepro.com/add-author-social-profile-links-to-thesis/

    both the posts make a nice tut,

    cheers,

    serge

    • http://designpx.com/ Jason Manheim

      Absolutely! Thanks for sharing, Serge.

  • Avinash D’Souza

    Love this post…thanks for pointing me to this Serge!

  • http://www.shoutmeloud.com Harsh Agrawal

    Thanks a lot for the guide and I tried implementing on one of the site but when using Rich snippet preview, I’m getting this error:
    Warning: Missing required field “updated”.
    Warning: Missing required hCard “author”.

    http://www.google.com/webmasters/tools/richsnippets?url=http%3A%2F%2Fwww.callingallgeeks.org%2Fauthor%2Fdenharsh%2F&view=

    Any help will be appreciated!!

    • http://designpx.com/ Jason Manheim

      Those warnings (not errors) are perfectly normal, Harsh. As long as you get this message:

      Verified: Authorship markup is correct for this page

      …which you have, then you implemented everything correctly.

      • http://www.shoutmeloud.com Harsh Agrawal

        @Jason Yes I got that message..and I also checked in Webmaster forum and realize many users are getting the same error. Now I have to see when Google will start showing my images., I will repost this post on my blog just for Thesis theme and will give credits to you. Kudos for this great work :)

        • http://designpx.com/ Jason Manheim

          My pleasure, Harsh, thanks.

          It took Google about 2-3 weeks before my author images started to show on SERPs.

  • Avinash D’Souza

    Jason,

    Does this(“LINKING YOUR GOOGLE+ PROFILE TO YOUR AUTHOR PAGE”) section work anymore? I cant seem to find a specific links section or a dedicated about me checkbox.

    Any alternatives to this?

    • http://designpx.com/ Jason Manheim

      Just adding a link back to your author page from your Google+ profile will do it. Either under the “Other profiles” or “Contributor to” headings.

      • Avinash D’Souza

        Thanks Jason, much appreciated. :-)

  • http://myuntangledlife.com Jacob Clayton

    Fantastic post….thanks so much for the tips which worked perfectly on my custom site as well as some Thesis blogs.

    • http://designpx.com/ Jason Manheim

      My pleasure.

  • glenwoodfin

    My user name in WordPress is ‘admin’, but in the Profile I have said my name is Glen Woodfin. I have added all the rel=me links in my admin profile on my WordPress blog. Will that work? I went to Google’s approval page for rel links and it says it’s connected to my Google+ profile.

    • glenwoodfin

      The reason I ask is, even though I passed the Google rel tag verification 3 weeks ago, my profile pic has yet to show up in the Google SERPs for my http://www.glenwoodfin.com WordPress blog.

      • glenwoodfin

        It shows up in Google searches when I’m signed in to my Google account while doing searches, but it doesn’t show up for searches when I’m not signed in to my Google+ account.

        • http://designpx.com/ Jason Manheim

          You should be fine since your Google profile links to this page: http://www.glenwoodfin.com/bio/ which then links back to your Google profile. However, to be sure I’d put a link to this page: http://www.glenwoodfin.com/author/admin/ on your google profile.

          It actually took about a month before mine started showing up.

  • http://www.howtoarena.com Faheem

    Hey Man, I must this is a brilliant guide but I’m facing some issues. I’m using thesis BlogSkin and it has its own Author Box. Now here’s what I did:
    1) Copied rel=author code in my custom_functions.php
    2) I think I skipped something here
    3) I copied LINK AUTHOR NAME TO GOOGLE+ PROFILE FOR THESIS USERS code in custom_functions.php
    4) Changed the URL on my Google+ Profile

    I know I’m missing something can you tell what more should I add ?

    Best
    Faheem

  • http://www.howtoarena.com Faheem

    Figured it out, thanks man!

    • http://designpx.com/ Jason Manheim

      Great!

  • Mike

    Jason,

    At the link http://designpx.com/author/jason/ how did you add your google profile link? I run a multiple author website and would like to distinguish articles among them. It seems like if I can get a link there, I should be all set. Thanks!

    • http://designpx.com/ Jason Manheim

      If you’re a Thesis user you can use this tutorial.

  • http://twitter.com/JasonBDavis Jason B Davis

    Worked like a charm – Thanks so much fellas. I wanted to link my author name within post excerpts (in the loop), rather than atop of my author page. Any takers on this one?

    • http://designpx.com/ Jason Manheim

      Depends what theme/framework you’re using. You’re going to need to link new post headline meta info.

  • http://www.lelakikacak.com/ Lelaki Kacak

    I’m just follow tutor from Google. Its work fine.. :)

  • http://wpressclub.com/ Bob Rom

    Brilliant tutorial. This must be the best article about adding authorship to your WordPress site.

    • http://designpx.com/ Jason Manheim

      Thanks, Bob. Tried to hit every point.

      • http://wpressclub.com/ Bob Rom

        I read about this many articles (Yoast has one but not quite clear) but this one is best for Thesis users. Just to mention, I came across a Genesis Child theme that has this feature built in, the Google authorship thing…

        • http://designpx.com/ Jason Manheim

          Yeah there are quite a few themes that have it built-in now. Which Genesis child theme was it?

  • http://blog.canal.cl/ ignace

    Great article, thanks. The part about it not working on “freely hosted” sites doesn’t make any sense to me though. Is there any supporting documentation about that?