Meta Tags in WordPress

by admin on June 30, 2010

in Blogging

Meta Tags in WordPress

WordPress, out of the box, is very good in optimizing your blog for the search engines. However, a default installation of WordPress does not give you the ability to add the description and keywords Meta Tags, to your posts.

But, Do I Really Need Those Meta Tags?

Since many search engines has devalued the information in the Meta tags, they are not as important anymore, to get a good ranking, as they were a couple of years ago. However, the description tag is still important, not for SEO maybe, but to click-troughs from the search engines results, though.

Many search engines e.g., Google, displays the information in your description tag, in their search results. If they cannot find a description tag inside your post, they create their own, usually from the first paragraphs of your post.

That often results in a not so attractive description of your post.

People often tend to scan their search results. Therefore, if the description for your post, looks massive and incoherent, chances are that they chose to click on a result with a description that is short, to the point and tends to stick out.

So, even if Meta Tags isn’t that important for SEO, they give you a chance to explain why someone should click though to your post!

OK, How Do I Get Those Meta Tags?

Luckily, there are several ways to add Meta Tags to your post and pages.

You can use a theme, with that function built-in, like the spectacular Thesis Theme for WordPress or you could simply use a plugin, like the All in One SEO Pack, which will create your Meta Tags.

How To Use Custom Fields For Meta Tags

If you don’t want to use a plugin and/or your current template doesn’t support Meta Tags, you can use the custom fields in WordPress, to add Meta Tags to your posts, rather easily.

To start using custom fields, you’ll need to edit your theme, so make sure you take a backup of your theme, BEFORE you start editing anything at all!

First, open up your header template, usually named header.php, using either a standalone editor of your choice or in the Theme Editor, found below the Appearance box, inside WordPress.

Second, find the line with the tag </title> and copy and paste these two lines directly under it:

<meta name="description" content="<?php $key="Description"; echo get_post_meta($post->ID, $key, true); ?>" />

<meta name="keywords" content="<?php $key="Keywords"; echo get_post_meta($post->ID, $key, true); ?>" />

When you’re done, it should look like the image below.

If you cannot find a line with </title> in it and you’re not familiar with how header.php in WordPress is constructed or with coding, then you should use a plugin, instead.

Now, save your changes.

To use your new Meta Tags function, you’ll need to add two custom fields. To do that, scroll down to a section named Custom Fields, which you’ll find below the edit box, on your post page.

Click on the “Enter new” link, like in the example below.

You should now see an empty field, where you will type Description, as in the example below.

After you’re done writing your description, click on the button labeled “Add Custom Field” and repeat the process to create a field for Keyword, as well. Make sure that the first letter is capitalized, for both description and keyword, or else the code will not work!

Publish or update your post. To see if you your Meta Tags works correctly, visit your post and right-click and select “View Source”.  If everything worked, you should be able to see your description and keywords in the head section of your post.

Since your new fields are stored, you don’t have to add them again, next time you write or update a post. Just click on the drop-down menu, shown in the image below – select your field, enter your text, click the “Add Custom Field Button”, and you’re done!

As you can see, it’s fairly easy to use the custom fields feature, to generate your own meta tags, without the need of a plugin!

Visit http://codex.wordpress.org/Custom_Fields, to learn more about custom fields and what you can do with them.

Leave a Comment

Previous post:

Next post: