Add meta-keywords to category pages in WordPress

Posted by Ghatozkat on January 02, 2009

keywords Here’s another blog advice for you. If you are using All In One SEO pack plugin and are not able to add meta-keywords to category pages in WordPress, I am gonna teach you how to do that in this post. Some of you might argue that meta-keywords are obsolete things. Yes, it is said Google does not give a damn to them but we know Yahoo still uses meta-keywords for sure. Hence, if you want to rank better in Yahoo, you should consider adding meta-keywords to all the pages that you want to show up in Yahoo’s search results. Category Pages are very important pages from SEO point of view, so you need to make them perfectly search engine optimized and that’s exactly what we are going to learn in this post.

The default WordPress installation does not provide any support for adding meta-keywords to category pages without playing with the code. Yes, there are plugins to make life easy. However, the very popular All In One SEO pack plugin can only be used to add meta-keywords to posts and pages, but not to category pages and it is this shortcoming of All In One SEO pack that inspired me to write this post. :-)

Plugins like HeadSpace2, SEO Title Tag plugin do provide an interface to add meta-keywords to category pages. So, if you have no SEO plugins installed, getting one of these two is a good idea if you want to do a complete optimization of your blog. But what if you are already using All in One SEO plugin?

The author of HeadSpace2 plugin says it lets you import data from All In One SEO pack. I tried doing the same, but a weird thing happened. All of the meta-keywords entered in All In One SEO pack got imported as tags. Thankfully, I try plugins locally on a dummy WordPress installation on my PC whenever possible before trying them on my blog. Hence no damage was done to my blog. After I could not use HeadSpace2 plugin, I decided to check out SEO Title Tag plugin, but after reading its documentation, I came to know that it does not support importing data from All In One SEO pack.

So I was left to either install HeadSpace2 plugin or SEO Title Tag plugin and import all data from All In One SEO pack manually or find something that would work with the All In One SEO pack. Luckily I found a code that would work with All In One SEO pack in a few minutes after I started playing with my theme files.

The code is not hard at all and is one line per every category. The code needs to be added to the header.php file of your theme near other codes used to generate other metadata. For example I added the code after the following line in the header.php file, used to generate the generator metadata:

1
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />

The actual code to add the meta-keywords is the following:

1
<?php if(is_category('XXXXXX')) { ?><meta content="metakeyword1, metakeyword2" name="keywords"><?php }?>

where,

XXXXXX = the slug of the category to which you want to add meta keywords to.

metakeyword1, metakeyword2 need to be replaced with your actual keywords.

Add similar codes until you are done with all of your categories.

Note: If you want to add meta-description to category pages in WordPress while using All In One SEO pack plugin, you can do so easily by editing a category and writing a description for it. This description will be used by the All In One SEO pack plugin as meta-description for that category.

If you find it difficult incorporating my solution, post a comment and I would be happy to help you out.

Happy blogging with WordPress and All In One SEO pack plugin !



Comments:

(14) posted on Add meta-keywords to category pages in WordPress

Make a Comment: