The Canvas of Ryan Sadwick

Using Authorship in Wordpress

Configure your Wordpress blog with rel="author" and rel="me"

Using Authorship in WordPress

Jun. 14th | Posted by 5 comments


This blog post pertains to WordPress 3.1 and below. WordPress 3.2+ fully supports Authorship rel=”author”. However, if you’re using an older theme with WordPress 3.2, there is a slight chance your blog does not support Authorship.


What is Authorship?

Google supports the authorship markup. If you write content on websites, whether a blog post, video, or image gallery – you can tell Google that you’re the author of the content you’ve created. Let’s go into more detail:

Authorship with Google and WordPress

An author page is a page about a specific person that writes articles, blogs, pictures, video, etc. A simple example: this site displays the author of each blog post. The posts that I write list my name (and other authors if needed). There is also a link on my name. It links to my “author” listing, where it lists all other blog posts I have written. The link jumps to http://ryan.sadwick.com/author/rsadwick/

Authorship with Google

As the illustration above points out, the author page links all of the posts created by that specific author. If your site is using rel=”author”, Google can use the author information to to identify the author of an article or page and determine the relevance of that page to a user’s query. To do this, you add rel=”author” to your link:


Note: As of now, author pages need to be on the same domain. This allows Google to tell the difference between content that could have been scraped verses the actual author’s posts. (This could change over time, like Canonical did).


Using rel=”me” on other sites.

Google also supports rel=”me” that allows the author to place a link to their website on different site that isn’t on the same domain. For example, let’s say I have a few profile websites that I may have written blog posts on, such as social networking sites. For example, the site is setup like so: http://example.com/authors/rsadwick On that and other sites, I could use the rel=”me” authorship:

The reciprocal rel=”me” links lets Google know the profiles at http://ryan.sadwick.com and http://example.com/authors/rsadwick are the same person.

Consider the illustration below:

more Authorship with Google

How to add authorship on WordPress?

If you’re using a custom WordPress theme, it may or may not support Authorship. To check, you can use the Rich Snippets Testing Tool or look at your author link in the browser by viewing the source and check to see if rel=”author” exists.

If rel=”author” doesn’t exist, I’ll show you how to create a filter to override the WordPress method: the_author_posts_link

1. On your WordPress site, locate your functions.php. It should be located in your theme directory. If you do not have a functions.php, simply create one.

2. We want to override this WordPress method: the_author_posts_link function since we don’t want to edit it directly. If we did edit the WordPress core directly, we’d have to update it every single time WordPress updates. Let’s use add_filter instead!

So let’s create this method in the functions.php file:

4. add_filter simply inserted our override_author_posts_link instead of using the WordPress method the_author_posts_link, which did not have the rel=”author” attribute.

What Did We Do?

The the_author_posts_link method displays a link to all posts by an author. So, before our modification, the author link was rendering out the markup with the link and title to the author posts page… however, it wasn’t using the rel=”author” at all.

We simply added a filter in our theme’s functions.php. I copied the method from author-template.php to functions.php and renamed the method to override_author_posts_link and added the rel=”author” to be rendered in the markup.

Also, instead of calling the_author_posts_link, we apply the filter: override_author_posts_link is called instead and passes the $link that contains the modification we made.

So now when the_author_posts_link is called, our filter uses override_author_posts_link instead:

Most themes call the the_author_posts_link method when listing posts in WordPress. If you’re having trouble and need assistance, please contact me. I’ll be glad to assist you, however please be sure to give my tip jar some love.

Authorship helps with SEO.

In conclusion, using authorship creates relationship between a content page and an author page. This can aid your SEO efforts with all the websites you own.


5 comments Add a comment

  1. Evan W.

    Great post. I was searching for information about the iOS Google+ app today and noticed Mashable authors all appeared with their pictures in Google’s listings. Your post was definitely the most thorough at explaining the new authorship features.

    It looks like WordPress 3.2 added rel=”author” automatically to my site, but it isn’t showing authors in Google search results yet. Perhaps it’s a matter of size/popularity, or time?


  2. Ryan Sadwick

    Evan, I’m not sure how Google is crawling author pages but I’m sure it may take some time to crawl.

    Make sure you use the Rich Snippets Testing Tool to make sure you don’t have any errors. The successful message should read something like: “Verified: Authorship markup is correct for this page”


  3. George Coghill

    Ryan,

    Thanks for the tips here. I’ve implemented the rel=”author” using a different method, but my rel=”author” links indeed show up in my source code. I have them pointing to my About page, with links back to all my online profiles. Yet, no love from the Rich Snippets Testing tool.

    My main website works fine, but the WordPress blog does not. Even more strange, at one point my blog posts were indeed registering properly with the Rich Snippets tool, only to go back a day later to the “Empty page” warning, and that no author data could be found.

    Any help would be much appreciated (and tip-worthy!).

    Blog is here: http://georgecoghill.com/blog


    • Ryan Sadwick

      Hi George,

      On your about page, I didn’t see any rel=”author” markup. You could make a link to your name and within the link a href tag, put in the rel=”author”

      If the rich snippet tool still doesn’t validate, try linking your Google profile “about” section instead since the link to your “about me” page is on the Google Profile page.

      Let me know how that goes.