Adding Author Authority (rel=”author”) To WordPress – Plugin Required?

I decided to have a play with adding the new Google Author Rel=”author” attribute to WordPress. It is really very simple to do with WordPress out of the box, although an old plugin is needed for a basic set up to work, but it is a one click install and activate job (UPDATE – a plugin may not be required any more, see comments below. Not tested yet).

First you need to create your author page which for a small blog can just be your current About page if you do not wish to make a new one – I will use my About page as an example. I do not see any point in creating a new one, not just yet at least. Update: JohnMu suggests using individual author pages unless you are the sole writer of a site.

So next up is to make use of your WordPress profile “Biographical Info” box. In that you can simply write something like:

This entry was written by <a rel="author" href="/about">Webologist</a>.

Then in your theme template files you need to add the following code, ideally just at the bottom of your articles. In some themes this will be in the single.php (and page.php) files, in some it may be in functions.php or loop.php. Depends on the theme really.

In this theme (Magazine Basic) I have placed the code at the top of comments.php so that the profile link appears immediately after the content and before the comments.

If it was placed in single.php it would appear at the bottom of the comments and if in the loop.php you need extra WordPress markup code to stop it appearing everywhere. If you want the author info to appear after every category and tag excerpt then putting it in the loop.php is the simple solution.

Once you chose where to put it, this is the code:

<div class="postauthor"><?php the_author_description();?></div>

You can then also add some fancy styling in your stylesheet to the profile if you like.

WordPress Problem: rel=”author” not allowed in the Profile Box

But there is (or maybe was, this may no longer be a problem, see comment below from Luiz Marques) a problem. By default you cannot add rel=”author” to the user profile box. WordPress sees something that is not allowed and strips it out. This is where a plugin will be best to fix the issue so that you do not have to use an old and unsupported plugin which is not really ideal.

Here is how you allow rel=”author” in the WordPress profile box:

Weasel’s HTML Bios

There is a very old plugin which removes the stripping out of HTML from user bios. And it still works! The plugin is so old that the plugin website no longer exists. Here it is on WordPress: wordpress.org/extend/plugins/weasels-html-bios/

For some reason there are 2 versions which look identical listed in the WordPress plugins. I picked the second one and it worked OK. I added rel=”author” to the profile box and WordPress did not strip out the code.

A word of caution – the reason WordPress strips code out of the author box is so that your authors cannot sneak in some spammy or dangerous code when you are not looking. Remember, any code added with populate all articles written by an author and you do not get an alert when they change something. So someone could write 20 very nice posts then come back a month later and drop their links and ads in their box. So only use this on sites where you trust your writers!

Allow REL= and HTML in Author Bios Plugin

There is a new plugin that replaces Weasal’s somewhat open to abuse method, it is called Allow REL= and HTML in Author Bios. I just tested it and it works a treat.

Update: Just noticed that the Plugin page says “Enables use of REL= or anything else in Author bio area (for Google+ search results). WARNING: CAN BE USED FOR EVIL! Make sure you trust authors!

Sounds like it does the same thing as Weasal.

Anyway, as you can see just below is my little by line.

With this method each author will need to manually add the code (or ask the web admin to do it) and then link to an author profile page, that you will also need to create.

No doubt someone is creating a very snazzy WordPress Rel=”author” Plugin as I publish this.