Ultimate Guide to WordPress SEO – Optimized Titles

Arguably, one of the most important elements of a website from an SEO perspective is what comes between the <title></title> tags in the header of your page. Take a look at any search result page in Google and you’re probably looking at a list of websites with big blue links … and the text of those links is none other than the text Google found between the <title></title> tags when crawling the page.

So, this next post in our WordPress SEO series will cover how to control what gets displayed in that section of our site, and thus not only controlling what the Search Engines display as the title of our post/page in results pages, but also leveraging a powerful tool for ranking for those keywords we’re targeting.

While the complete order of tag importance is debated, one thing is for sure: the <title> and <h1> tags are definitely at the top in terms of importance for search rankings.  Think about your tags as a means of communication with the search engines rather than display elements.  What you put between the <title></title> tags is considered by the search engines to be THE MOST important information about the page it is viewing.

So, being able to control this is vitally important.

Structure

If you look at just about any WordPress theme worth its salt, you will find the title generating code in the header.php file, and it will look something like this:

<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>

As you can see, we are going to be doing some intermediate code hacking in this tutorial, so be prepared.

What you’re seeing are called “Template Tags” and they are what WordPress Themes use to display dynamic content that is being stored in the database.  For a complete list of these template tags, view this Codex Page.

The template tags we’re interested in are wp_title(), bloginfo(’name’), and bloginfo(’description’).  Respectively, they output the title of a single post or page and the name and tagline of your site (as defined in your Settings).  Many themes have started optimizing this section automatically, and some have even gone as far as using many conditional tags to display specific information related to various archives (tag, category, date, etc.), but I have found it more than adequate to optimize for Single Posts, Pages, and your homepage.

The Default Theme

The default theme structures it’s <title> text like such:

<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>

Now, this format is actually bad for SEO, since the content it puts first is the title of your blog/website.  Remember how results pages in Google show the content of the <title> for results?  Well, if you want people to actually click on your page/post when viewing reults, then you need to give them the title of your post/page as soon as possible.  The most irrelevant part of your titles is your blog’s name.  So, move it to the end instead of the beginning.

Here’s a quick way of doing it:

<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :: '; } ?><?php bloginfo('name'); if(is_home()) { echo ' :: '; bloginfo('description'); } ?></title>

In a nutshell, this code does the following — if viewing the homepage, it will display “Title of Blog :: Tagline of Blog” — and if viewing a single post or page it will display “Title of Post :: Title of Blog”. This puts your most important content first!

You Don’t Need a Plugin

I know that a lot of you out there are screaming at your screen for me to just recommend using a plugin like the All-In-One SEO Pack, which will handle this <title> optimization for you, and even give you more options than you can get by modifying your theme.  That’s true, but please hear me out …

Yes, I do believe in using themes, not plugins, for outputting HTML that will be publically visible.  But if you insist on using a plugin, then let me please encourage you NOT TO USE a certain feature of the All-In-One SEO Pack.  That feature would be the “Custom Title” feature, which will allow you to use title text other than the text in your ACTUAL post/page title.

Some people find this advantageous because it allows you to “keyword stuff” their title, and game the system.  But in my opinion, if this continues, the search engines will downgrade the value of the <title> and hurt everyone’s rankings.

So, as an alternative, if you want to use keywords in your <title>, then you need to use them in the ACTUAL title of the post or page.  And using the method I outlined above will do that very thing.  I’m certainly not discouraging you from using keywords in your Title, but if it can be avoided, for the sake of the future of your content, make the <title> and the Post/Page title exactly the same.

Tomorrow, we’ll be talking about header tags — when to use which tag (h1, h2, h3, etc.) for the most SEO benefit. Don’t miss it!

30 Comments
  1. Lee

    You’ve got a great SEO series here Nathan. SEO techniques are often neglected, especially in Wordpress blogs, and simple techniques like optimizing the tags and permalinks can make a huge difference. Keep up the good work!

    October 7, 2008 at 11:12 am Reply to this comment
  2. Angel Cuala

    As a newbie in WP, I have been looking for some SEO tutorials that are reader-friendly and I am glad you are among them.

    Anyway, I got my free theme from Daily Blog Tips so I think I made the right choice.

    But then, I will look at it and find how I can improve it more through your tips.

    I am just sure if Daniel (Daily Blog Tips owner) will allow me to have some changes.

    By the way, I just subscribe to your blog.

    Thanks!

    October 7, 2008 at 9:51 pm Reply to this comment
  3. Scott Ellis

    Nathan,

    While I agree that people should use the title manipulation of the All-In-One-SEO plugin to game the system, they could use it just as easily to put in the actual title of the post (consistency) followed by whatever they want without having to manipulate any code, which is advantageous to those a little less familiar with doing so. If there is a disadvantage to doing so I’d be curious to hear your take. I wrote a post a while back on Images and SEO so please take a look, if it is all useful in your series I’d be happy to hear any suggestions or counter arguments.

    http://www.vsellis.com/technology/search-engine-optimization-images/

    October 8, 2008 at 11:20 am Reply to this comment
  4. Scott Ellis

    whoops… :) Read “people should use” as “people should NOT use”

    October 8, 2008 at 11:22 am Reply to this comment
  5. Nathan Rice

    @Scott Ellis:
    But that’s exactly what the “whatever they want” would be — gaming the system. I’m not saying to never use it, but the abuse of that option is going to come back around eventually. My best guess is that Google will start to penalize users whose TITLE and H1 do not match.

    Remember back when search engines used to put a high priority on META Keywords? And as soon as users started abusing that (using Keywords that had nothing to do with the post), the began devaluing them, enough to where they became a far less significant SEO tool than they were before.

    That’s my fear for using different text for your TITLE than the actual title of your Post/Page.

    October 8, 2008 at 11:41 am Reply to this comment
  6. Cezar

    great tip.
    i would mention that you seem to have forgotten o close the } at the end of description.

    October 9, 2008 at 4:44 am Reply to this comment
  7. Scott Ellis

    @Nathan

    Understood, but “whatever they want” could also be “post name – blog name.” Those who will choose to game the system will do it whether or not they use the All-In-One SEO Pack.

    I think all we can do (as you have done) is encourage people not to abuse it.

    October 9, 2008 at 9:19 am Reply to this comment
  8. Nathan Rice

    @Scott Ellis:
    True enough. But then again, that can be done by a single line of code in the header.php file, and the change would be permanent. But sure, as long as you’re not gaming the system, using the SEO pack for that purpose will probably have zero adverse effect.

    October 9, 2008 at 10:28 am Reply to this comment
  9. Nathan Rice

    @Cezar:
    Indeed I did. I’ll try to get that fixed ASAP.

    October 9, 2008 at 10:29 am Reply to this comment
  10. erica stjohn

    I changed my theme so it uses this thanks!
    I did have to change

    { echo ‘ :: ‘; bloginfo(’description’); ?>

    to

    { echo ‘ :: ‘;} bloginfo(’description’); ?>

    to get it to work.

    October 13, 2008 at 2:41 am Reply to this comment
  11. Joel McLaughlin

    WOW. Great post, I am going to integrate this in to my Wordpress pages.

    October 15, 2008 at 2:28 pm Reply to this comment
  12. Nathan Rice

    @Joel McLaughlin:
    Hope it helps a lot!

    October 15, 2008 at 5:59 pm Reply to this comment
  13. Shawn

    Greatpost Nathan. I do need some help though. I placed the code in my header like you wrote above

    It works however I get the “::” signs between my title and blog name.

    Any idea why.

    October 22, 2008 at 11:20 pm Reply to this comment
  14. Nathan Rice

    @Shawn:
    Those are supposed to be there.

    October 22, 2008 at 11:23 pm Reply to this comment
  15. Shawn

    Now i notice them on yours. Thanks I thought something was funny. Appreciate your help!

    October 22, 2008 at 11:25 pm Reply to this comment
  16. Hans

    This is really funny. I just discovered the SEO plugin and thought it would be good for my SEO to alter the title tag.

    Yesterday i spend about 4 hours trying to get something done with custom fields to alter the title tag.

    I thought up until know that the title tag was a overall description of the page rather than just a ‘copy’ of the h1 tag.

    But somehow this topic keeps me wondering. Is it really “gaming the system” to alter your title tag? what if the content in the title tag comes back in the overall content? Why would that be bad? If you keep the title reasonable without to much ’stuffing’ would it really damage your seo or would you just feel bad because your ‘gaming’ the system?

    Don’t get me wrong I’m really new to SEO and im always skeptic about what people say unless they proof something. I love the Internet and if someone (anyone?) would proof that it is absolutely bad to alter the SEO tag I will be glad not altering the title (saves my time you know).

    WOW, great post! this is a new record of the longest comment i have ever written :)

    October 29, 2008 at 7:53 pm Reply to this comment
  17. Fantasticfreehosting

    Again thanks for the post.

    I am seriously thinking of deactivating ‘All in one seo’ plugin and just implimenting the advice given on these pages to see what results I gain.

    Thanks :)

    November 23, 2008 at 6:37 pm Reply to this comment
  18. Sebastin

    I have an issue when there is pagination for Home / Category pages. While analizing the content with Google Webmaster tools, it complains of (duplicate title tags and duplicate meta descriptions) for those pages.

    That is because the title and description are same for the paginated pages.

    Can you suggest a hack to add page number (or some good idea) to title and description please?

    December 17, 2008 at 9:19 am Reply to this comment
  19. Mazri

    i prefer using plugin coz it is easy. Just plug and play.

    December 31, 2008 at 2:51 am Reply to this comment
  20. Jason

    i was still wondering why wordpress themes dont provide a provision to add the google analytics code and msn live code to the header itself. i thought i shud point as you may want to include this as one of the point quite often missed by many..

    i know theres a WP plugin for that which builds the sitemap.. but why having to install the plugin..

    any thoughts

    February 5, 2009 at 2:01 pm Reply to this comment
  21. benjamin m.

    Hello,

    I’m a new wordpress user and I really need to optimize my theme foer SEO.

    In my header.php file of my theme I have inserted this code for Title, do you think it’s pertinent too ? thanks

    February 15, 2009 at 7:59 am Reply to this comment
  22. Sharon

    Hi,
    Thanks for your article. I found it very helpful. I have my wordpress blog linked to an additional database which pulls information based on id. Is there any way to use this technique to display individual title tags for each id, rather than having multiple urls with the same Title Tag. ie. More Information

    Look forward to hearing from you.
    Sharon

    March 25, 2009 at 6:31 am Reply to this comment
  23. Deven

    That is incredible article Nathan. Actually as wordpress developer myself, my client always ask me to make theme more on the SEO beneficial side, and that is a great tip. Thanks for sharing.

    May 8, 2009 at 1:31 am Reply to this comment
  24. mervin

    thanks for the incredible post.. luking forward to have such more posts from u nathan. cheers!

    June 3, 2009 at 2:28 pm Reply to this comment
  25. Susane

    Thanks for sharing the post. I’ll prefer using plugin coz it is easy. Just plug and play

    June 28, 2009 at 9:57 am Reply to this comment
  26. Namneet

    Beneficial post!

    June 28, 2009 at 9:59 am Reply to this comment
  27. Eren Mckay

    I’ve been trying to find a way to take my main blog title out of the end of my individual posts titles.
    I don’t want my main blog description in the title tag of individual posts- – it comes after the main post’s title but I still don’t want it there.
    I’ve searched for quite some time now and can’t seem to find the answer to this- do you know what I should do?
    Thanks for any help.
    All the best,
    Eren

    June 29, 2009 at 9:35 am Reply to this comment
  28. Scott Ellis

    Eren,

    Probably a quick change to a line of code in your header.php file.

    Drop me a line if you need help changing it.

    BlackBox-Tech.com

    Scott

    June 29, 2009 at 10:31 am Reply to this comment
  29. Eren Mckay

    Thanks Scott- I just found a plugin called SEO title tag and I’m installing it right now. I hope that this plugin works to strip away the blog name from the end of the posts.
    Thanks for offering help. If you ever want to talk – my skype id is erenmckay so you can add me there if you want.
    All the best ;-) ,
    Eren

    June 29, 2009 at 4:57 pm Reply to this comment
  30. Johan

    Is there any way to use this technique to display individual title tags for each id, rather than having multiple urls with the same Title Tag. ie. More Information

    July 4, 2009 at 12:48 am Reply to this comment
Leave a Reply
You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>