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!

Comments

  1. Lee says

    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!

  2. Angel Cuala says

    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!

  3. Scott Ellis says

    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/

  4. Nathan Rice says

    @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.

  5. Scott Ellis says

    @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.

  6. Nathan Rice says

    @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.

  7. erica stjohn says

    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.

  8. Shawn says

    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.

  9. Hans says

    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 :)

  10. Fantasticfreehosting says

    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 :)

  11. Sebastin says

    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?

  12. Jason says

    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

  13. benjamin m. says

    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

  14. Sharon says

    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

  15. Deven says

    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.

  16. Eren Mckay says

    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

  17. Scott Ellis says

    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

  18. Eren Mckay says

    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

  19. Johan says

    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

  20. Brad says

    Thanks Nathan! I knew switching the name and description in the title was a good idea – just needed the code to be able to do it. Thanks for sharing!

  21. Joomla Bear says

    Nice post Nathan. I’ve just implemented your method on my Joomla template blog, but wondering if it’s possible to NOT show the latest post title for the blog home page? I’m staring at the php and I can’t work it out.

    e.g. If someone bookmarks my blog for future reference I’d rather it just had my main title rather than the post of the day.

    Thanks

  22. TIBZ says

    Awesome, thank you. Took me a while – I feel like a programmer now. Good to know bits and pieces abput the html code – even in the age of wysiwyg!