How-To Add Google Authorship To WordPress Correctly

487 Flares 487 Flares ×

Adding Google Authorship to WordPress ThemeDuring yesterday’s morning reading I happened on Ann Smarty’s post about the recent changes to Google Authorship and Mark Traphagen’s takeaways. What caught my eye was that we are not supposed to have authorship on all pages of our blogs, only the pages written by you should have authorship attribution.

Google discourages from featuring authorship on the home pages and category pages as well: The URL/page contains a single article (or subsequent versions of the article) or single piece of content, by the same author… The URL/page consists primarily of content written by the author….

This means you are only supposed to have the authorship link on articles or blog posts that were authored by you – the link should NOT appear on home, contact, archive, or any other ‘site’ pages. This is important because many WordPress bloggers simply stuck the authorship link in their header and thought they were good to go, but now that Google has come out with new guidelines it is best to update your blog if you can!

And That’s The Problem

How exactly do you show the authorship link on only blog posts or pages and not the whole WordPress site? It isn’t exactly easy for many bloggers as Ann herself noted:

Now going to figure out how to remove my authorship from the home page of the WordPress blog which is too old to be too flexible

The good news is that while the code required is certainly a bit more complicated than just pasting in your authorship link, it is almost as easy to do, and I’ll show you how.

Adding Google Authorship Using The WordPress SEO Plugin

I wrote a whole separate tutorial for those of you that use the WordPress SEO plugin for Google Authorship.

Adding Google Authorship To A Regular WordPress Theme

You should only use this method when you don’t have a plugin or theme setting that works properly. This is because the changes I note here could be overwritten when you update your theme.

What you're looking for in the WordPress code editor

Click for a better view!

  1. Backup your theme files in case you make a mistake (don’t skip this!)
  2. Log into your WordPress installation and access the code editor. You’ll find the editor in the left navigation under Appearance.
  3. In the code editor ensure your WordPress theme is selected in the upper right dropdown menu, then click the header file (header.php) in the right hand column to display the header file in the editing window.
  4. Once you have the header file displayed look for the </head> tag. We’ll be placing our code just before that tag, if you can’t find it take a look at my screen shot.
  5. Copy the appropriate code (provided below)  and paste it just before the </head> tag and click the Update button to save the changes.

Adding Google Authorship To A Premium WordPress Theme

wp-authorship-hooks

Enter the code and select execute PHP

Most premium WordPress themes should allow you to follow the instructions for a regular theme above, however if you use a framework like Genesis or Thesis you probably won’t find the header file when you go looking in the editor.

On either of those platforms you have the ability to add hooks to the header either via hand coding or a plugin.

I’d recommend using one of the respective plugins, I’m using the Simple Hooks plugin for Genesis in this example. If you’re on Thesis I believe the hooks plugin you want is Open Hook which works similarly.

All you have to do is select the appropriate code from below and enter it into the Head Hook section of your plugin, in this case the head section is labeled wp_head Hook but it could be labeled slightly differently depending on which plugin you use.

Code Options

Posts Only
This code will add Google Authorship to only the WordPress posts.

<?php if ( is_single() ) {?>
<link rel="author" href="YOUR-GOOGLE-PROFILE-URL"/>
<?php }?>

Pages Only
This code will add Google Authorship to the WordPress pages (but not posts, home or archive pages).

<?php if ( is_page() ) {?>
<link rel="author" href="YOUR-GOOGLE-PROFILE-URL"/>
<?php }?>

Posts & Pages
And this code will add Google Authorship to the WordPress post and pages (but not the home or archive pages).

<?php if ( is_page() || is_single() ) {?>
<link rel="author" href="YOUR-GOOGLE-PROFILE-URL"/>
<?php }?>

Check Your Work!

authorship-working

Now that’s what I like to see!

Once you get the code installed it’s very important to check your work.

I have a complete tutorial on how to ensure Google Authorship is working that you should read so you never stuck wondering what’s wrong or if it’s set up correctly. Testing isn’t as simple as it appears!

Briefly, you’ll want to check the appropriate pages of your site to see if the authorship code is there when it should be (posts, or posts and pages depending on your implementation) and not where it shouldn’t be (like your home page or archive pages).

To do so just enter the appropriate urls from your site into the Structured Data Testing Tool and review the results.

If you have any issues just ask me in the comments and I’ll try to help you.

487 Flares Twitter 58 Facebook 63 Google+ 344 LinkedIn 7 Pin It Share 0 487 Flares ×

Comments

  1. I was just about to dive into Google Authorship today, thanks SO much for this Craig!!!

  2. …and for wordpress dot com sites?

  3. Nice job, Craig. Everyone should be aware, though, that if your theme developer updates the Header file, your changes will be overwritten. When updates happen, always check, and re-edit as necessary. Better yet, create a child theme with just a Header file with these edits. Never have to think about it again.

    • Craig Fifield says:

      Thanks Michael! I agree that there are better ways to do this long term but for now this is a good method considering most plugins, and I think even WordPress itself, isn’t handling this properly yet.

  4. Hi Craig,

    It seems there are certain codes are blocked in your comment system so I wrote of an article on how it’s done. In this article, the code (if it’s important) is shown properly. Here’s the link: http://goo.gl/ZAfFRT

    Sorry about all those comments. You can just easily delete those if you find all those as mess.

    Thanks,
    Dorell

  5. I originally put my code on my home page of my blog, but I also put my google+ rel=author code in my wordpress bio so it shows at the bottom of all of the authored posts I write and manually add to a page that doesn’t have my bio. That should do the trick once i remove my G+ code from my header home page, right?

  6. What about for ithemes builder? I can’t find a hooks plugin for them.

    • Craig Fifield says:

      Hi Ben,

      I don’t know that one, have you looked in the code editor like I mention in the post to see if you can find the header file?

  7. Craig,
    I’m guessing you wouldn’t do this for a multi-author site since the rel=author link would be in the author infobox.
    Also, as you hinted at above, WP isn’t doing it right either. In the twenty-eleven theme there is a field in the General Settings that is for your G+ link. If you are using twenty-eleven I’m thinking you should also make sure this field is blank.
    Your post caused me to track that down and correct it, thanks!

    • Craig Fifield says:

      Hi Robert!

      You are correct, you shouldn’t do this on a multi-author blog if you already have it covered another way. Just ensure if the admin writes that you’ve got the infobox set up properly. And yes, I had to dig all around as well looking for my link – some themes add it, a bunch of plugins add it, etc, etc.

  8. Hey Craig, thanks so much for sharing this! I’ve read quite a few posts on how to set up Google Authorship, but non of them were as clear and concise as yours. Will be sending my clients a link to this one as an easy reference/tutorial!

  9. Well I am back after playing around with it a bit.

    So with the WordPress SEO plugin, I had my Google Plus profile link in my user info. Then I added this code from Craig just before header (in child theme), and went to the testing tool. I was still appearing as the author of archive pages.

    So I went ahead and deleted my Google Plus link from my user info/author bio and left this snippet of code that Craig provided.

    I now have the testing tool showing me as the author for single and pages, but not for archive or home. In case anyone had the same curiosities.

    Thanks again!
    Jose

    • Craig Fifield says:

      Glad it worked for you Jose! Keep in mind this isn’t a perfect fix, if you update your child theme it could overwrite your changes. WordPress SEO comes close to getting it right and I’m sure they’ll update soon so I’d keep an eye on that.

  10. Thanks Craig, but what about posts by guest authors that have authorship already on those post, won’t this override that? Also, when someone searches by brand and my home page is shown, my authorship is displayed. Will that disappear once the tag is removed from my homepage? Google is the one that set these social share badges up to include authorship to begin with.

    • Craig Fifield says:

      Hi Brian,

      Yes and nobody knows for certain yet :) For a multi-author blog I’d recommend my newest tutorial for authorship using WordPress SEO. What happens to your homepage attribution is pretty much irrelevant – what will happen if you don’t listen to Google?

    • Brian, you could use rel-publisher for your home page, and instead of your picture, your company/website logo (or an image you assign in your Google+ business page) would show up in the serp when someone searches for your company name/homepage.

  11. Hi Craig,
    Your advice worked best for getting google authorship to work for me. I followed your instructions to the letter and I have received the all-clear message. I didn’t understand what you and Brad Y. were talking about regarding putting “my google+ rel=author code in my wordpress bio”.

    My Gravatar bio shows on every page. Is there a widget or something that makes my bio from my WP profile show up? If so, do I use the same code that I used for the Header page?

    Thank you for posting the best google authorship instructions.

    • Craig Fifield says:

      Hi Cheryl,

      You know what my favorite thing is after beer and dogs? MMA!! I’ve been a fan since VHS days – you are my new idol ;)

      I wouldn’t normally recommend using the gravatar bio as you are today – you can do the same thing with an author page *on your own site* and not have to link out like that. What Brad Y and I were referring to is somewhat similar, but it appears at the end of a post and usually comes from your user profile, a plugin, or even your theme (it depends on your config). When you have that, you have the option of linking out using rel=”author” to your Google profile in order to get authorship credit. It’s just a different option than they way I applied authorship in my post. You don’t need both, just one.

      If you already applied my fix, you should be fine, but if you update your theme you may overwrite those changes. You might want to checkout my newest tutorial that uses the WP SEO plugin, those settings won’t get overwritten.

  12. Thanks Craig, I have spent most of the day trying to figure this out on my own and then I found your article and it made it all very clear! I am not particularly technical and I have only been using WordPress for a couple of months but even I could understand your incredibly clear instructions! I have a carpet cleaning business and I have written all the content on my website myself – so in a way I am the author of my website. I was going to remove my authorship from all the pages and just leave it on the posts (blog) but then I started to think that maybe I should leave it on some of the pages as they really are informative like articles and I am not selling products so there are no product pages. What do you think? should I just remove authorship from home, contact us, service area, type pages or all pages? If I just wanted to pick and choose the pages – what do i do as far as the code is concerned?

    • Craig Fifield says:

      Hi Yasser,

      I would not recommend adding authorship to product or service descriptions – Google’s new guidelines seem to have been made to specifically clarify that you shouldn’t do that. However, you know your situation best so if you wanted to pick and choose pages you’d have to add the code to link back to your profile manually to each page/post. This is the code you’d use:

  13. Thanks for sharing this Craig – I believe I have fixed all of my blogs now.

  14. Thanks for the clear instructions. I added the code directly into the header, since I find programming easier. Very helpful!

  15. Hi Craig,

    Great post. What would you recommend for multi-author sites that don’t use the WordPress SEO plugin?

    Regards
    Marce

    • Craig Fifield says:

      Hi Marce,

      I’d have to ask why you’re not using the WP SEO plugin :) There isn’t another viable contender for SEO and it can also handle your Authorship needs saving you an additional plugin install which is better for your site performance.

  16. Thanks for your complete tutorial Craig
    I used as you told and every thing was fine but I used a sample profile for Autorship and not my original profile.The autorship test was successful.
    After that I wanted to add my original profile,but I couldn’t add it to all pages of my site.
    Now the main page is ok but the rest are not,I think because I tested them with the other sample one
    I see the following error:
    —————————————————————————————————————————-
    Authorship rel=author Markup
    Cannot verify that rel=author markup has established authorship for this webpage.
    First rel=author link from webpage: https://plus.google.com/101579212363599809179?rel=author
    Link (direct or indirect) from website to Google+ profile: Yes
    Public contributor-to link from Google+ profile to 123project.ir: No
    Note: The testing tool currently only checks the first rel=author link listed on a webpage for a link to a Google+ profile (https://plus.google.com/101579212363599809179?rel=author). It’s possible that authorship may in fact be working for this page because of other rel=author links on the page. To verify that authorship is working on this page, please ensure the first profile listed on the site links to the appropriate Google+ profile.
    Other rel=author links from page:
    https://plus.google.com/101579212363599809179?rel=author
    ——————————————————————————————————————-
    would you please help me what can I do?
    I can’t ever change the autorship for those pages that I used as a profile for a test?
    Thanks

    • Craig Fifield says:

      If you did a test, you’ll have to go back and fix whatever you did to set up the test. The only other thing I can tell from here is that you need to link from your Google+ profile to your blog as noted in this error “Public contributor-to link from Google+ profile to 123project.ir: No”

  17. I got a parse error :( Now I gotta figure out how to get my site back!! #frustrated. Why did it work for everyone else?

    • Craig Fifield says:

      Hi Becky,

      Sorry to hear that, ideally you shouldn’t hack the theme, you should use the WordPress SEO plugin which I mentioned at the beginning of the post, or since it looks like you are using Genesis you should have used the Simple Hooks plugin which I also covered.

      Now based on your error, I can’t be sure, but it looks like you edited your functions.php file?? I didn’t cover that at all in my tutorial so I’m not sure what you did :(

      Did you take a backup as I mentioned in step one? If so it should be an easy fix, if not I will try to help you later today. I have a full day of work I have to do, but if you are still stuck when I’m through, I’ll follow up and see if I can help.

  18. Hadn’t done this yet, was able to do it with the Get Noticed theme fairly easily. Thanks!

  19. Craig- great stuff and way to support your comments. I think I read through all of the comments, but wanted your feedback on this- It appears to be working on my multi-user blog and it checks out in the structured tool, however, when I do a search, only one authorship markup appears. Is it the case that Google will only display one on each search page? For instance, if you do a search on “kendall wolf-hirschhorn”, every single article is mine, but only the first article displays authorship. Thanks in advance.

    • Craig Fifield says:

      Hi Kevin, you got it – Google will usually only display an author once per page regardless of how many results they own.

  20. Thanks Craig for this piece of info ! I though have a little query. Instead of doing what you’ve explained above, Ive punched in my google profile in the profile settings in my WP Dashboard (I own all my posts & pages and I’m having a single author blog). I’ve also verified the authorship in my Google+ account. What startles me the most is that everything is showing right in the ‘structured data testing tool’ but the changes don’t reflect in the actual search query.

    my website : http://www.amitwrites.com

    • Craig Fifield says:

      Amit, try logging out of Google or using incognito mode and see if your authorship shows up. It can be difficult to get it to show your own otherwise.

  21. Thanks Craig,

    I use Genesis and I was looking for an easy way to do this. The Simple Hooks plugin worked like a charm.

    Sunil

  22. Wow, this is awesome. Thanks for the tutorial, I’ve been wondering how to get my Authorship settings correct in WordPress!

  23. how about authorship for homepage and categories?

  24. Hey Craig,
    I was reading your instructions on how to setup authorship and first it looks very easy, but for some reason I can not get it done properly – maybe you can help me with it. I followed each step and it shows authorship is working for this webpage, but email verification does not. I am not expert but with easy “English” instruction I hope I can do it. Thank much in advance
    Email verification has not established authorship for this webpage.

    Email address on the realestateprochicago.com domain has been verified on this profile: No

    Public contributor-to link from Google+ profile to realestateprochicago.com: Yes

    Automatically detected author name on webpage: Not Found

  25. Hi Craig,
    I am using Genesis framework and Eleven 40 child theme. Currently I inserted my Google+ profile URL in my URL profile as https://plus.google.com/+BasavarajTonagatti. But when I check the authorship for home page url http://www.basunivesh.com then it shows “Authorship not working for this page”. Also when I check with keywords in Google Search then even though each individual posts which are showing as authorship working for this page, will not display images. What may be the issue?

    • Craig Fifield says:

      Hi Basavaraj,

      You don’t want authorship on your home page, just your posts. As for not seeing the images, it’s up to Google when to display them (or not). Try logging out of Google and/or using incognito mode. If the testing tool shows it working, it’s working even if you can’t see it.

  26. Craig,

    Thanks for writing this article. I tested it with the Google Structured Data Testing Tool and it shows up but not when I search for it in Google. Do you know why this would be?

    I’m using this as a test post: http://desertrivers.org/light-momentary-afflictions-suffering-for-christ/

    • Craig Fifield says:

      Dustin,

      If you see it in the tool, it’s working. Google only shows authorship when they see fit, also you should be logged out of Google when trying to see it and/or use Chrome incognito.

  27. HI craig! Great tutorial…I pasted the link in the simple hooks plugin but for some reason authorship is still showing for my homepage, category pages etc. Do I have a hidden link somewhere?! So frustrating

  28. Hi

    Thanks for writing this, i’ve been trying to get this right on a few blogs for a while. My video site is still causing issues though although i think it might be my template being odd.
    When i add your code for posts and pages (not home) it does appear on the home page. I tried just posts (single) but that actually blocks it from posts as well.

    Any ideas?

    Ta

    James

    • Craig Fifield says:

      Hi James, Ideally I wouldn’t use the code to implement authorship if you don’t have to, I’d recommend using WordPress SEO instead. I have a tutorial for that over here.

  29. Hi Craig!

    Arg, I’ve been trying to get this to work right for a couple of months. I’ve set up authorship, and it shows it all correctly in rich snippets. However, when I search for something in Google, our page comes up without the author pic beside it. (It DOES say by:Kinda Wilson in ___ circles). But no pic! I’ve checked Google+ privacy settings a million times. Any thoughts? I’ve checked on numerous browsers, etc. Anyone know how to fix?

    I’ve been testing it with the phrase “beat priceline bidding plane tickets” to find the page: http://www.travelchicks.tv/how-to-bid-for-tickets-priceline/‎

    Any help would be appreciated!!

    • Craig Fifield says:

      Hi Kinda, You have to log out of Google and/or use incognito mode in Chrome, then do your search. Even then though, it’s up to Google, they only show it when they see fit. If the testing tool says it’s all set, it is!

  30. Great tutorial! Worked perfect. Thanks

  31. Thanks so much. Works like a dream. :)

  32. Hi! Criag ,
    My authorship was working but now its no more showing my picture.
    My site url is http://naturalweightlosstruth.com , can you pls have a look and tel me the reason !

    I have check with http://www.google.com/webmasters/tools/richsnippets and looks quite ok !

    Many thanks in advance !

Speak Your Mind

*

487 Flares Twitter 58 Facebook 63 Google+ 344 LinkedIn 7 Pin It Share 0 487 Flares ×