Based from Craig Fifield’s article on How-To Add Google Authorship To WordPress Correctly I was able to put a better way (hopefully) of doing the said thing.

The catch here is not to waste your time downloading plugins for you to easily integrate the Google Authorship recently from Google.

Here’s how you do it in as easy as 1, 2, 3…

1.) Open your theme’s functions.php file. If you’re using a child theme, use that one (definitely better).
2.) Add the following code below:

// Google Authorship Integration
if ( ! function_exists('google_authorship') ) {
    function google_authorship() {
        if ( is_single() || is_page() ) {
            echo '<link rel="author" href="YOUR-GOOGLE-PLUS-PROFILE-LINK" />';
        }
    }
}
add_action('wp_head', 'google_authorship');

3.) Replace “YOUR-GOOGLE-PLUS-PROFILE-LINK” with your Google+ profile. Save/Upload it and test using Webmaster Structured Data Testing Tool

Edit: Added safeguard to function and some minor corrections.

5 comments

  1. Aleksandr Oreshkin January 29, 2014 at 6:19 AM

    Reply

    Thanks for the post, definitely a better method than using the simple hooks plugin.

  2. Artem March 24, 2014 at 7:49 PM

    Reply

    Thanks man!
    Helped a lot.

  3. krysta September 13, 2014 at 1:20 PM

    Reply

    Where do I add that code in the functions.php file?

    • Dorell James Galang September 13, 2014 at 5:06 PM

      Reply

      Krysta – you could put it at the end or anywhere you wish to. If your theme’s functions.php file is empty then just insert it. It will look something like this below:

      EMPTY functions.php

      <?php
      
      // insert the code here
      
      ?>
      
      NOT EMPTY functions.php
      
      
      <?php
      
      // some codes above ... 
      
      // insert the code here
      
      ?>

Leave a reply

Your email address will not be published. Required fields are marked *