WordPress SEO: How to optimize the title tag for search engines

by Jean. 57 Comments -

In terms of SEO, the title tag is one of the most important things: In fact, the title appears as a link in search engines results and social bookmarking sites. Unfortunely, most WordPress themes displays the title tag in a non-optimized way. Let’s see how we can change that to obtain a really SEO-friendlt title tag.


As you can see on the above screenshot (Sorry for the French language!), by default, WordPress displays Blog name → Category → Artcile name in the title tag.

Though, we can see on the screenshot that Google truncated an important part of the article title. If the blog name and the category haven’t a lot of importance for the visitors, (They’re looking for some info, and don’t care who published it) the isn’t the case of the missing terms.
For exemple, there’s a huge difference between “6 tricks and tips to create your premium” and “6 tricks and tips to create your premium WordPress Theme“!

The solution to this problem is to modify the way your WordPress theme displays the title tag.

To do so, open the header.php file from your theme. The code used to generate the title tag might look like this:

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

As we can see, on that code the blog title is always displayed, nevermind on which page the visitor is.
Though, as I said before, most of the time the visitor didn’t care about the blog title, he’s just looking for info. And having the blog title displayed in all your title tags might make Google think it is duplicate content.

To achieve this hack, we’ll use WordPress conditionnal comments in order to generate different titles depending where the visitor is.

On the header.php file, replace the code we saw before (The title generation code) by this one:

<title><?php if (is_home () ) { bloginfo('name'); }elseif ( is_category() ) { single_cat_title(); echo ' - ' ; bloginfo('name'); }
elseif (is_single() ) { single_post_title();}
elseif (is_page() ) { bloginfo('name'); echo ': '; single_post_title();}
else { wp_title('',true); } ?></title>

This code will generate title tags according to the following model:

  • If the visitor is on the blog homepage: We’ll display the blog name.
  • If the visitor is on a category page: We’ll display the category name and the blog name.
  • If the visitor is on an article page: We’ll only display the article title.
  • If the visitor is on a static page: We’ll display the blog name, and the page title.

And you, do you have any tips and tricks to enhance the way your blog appears in search engines results? Let me know.

  • http://jamielesouef.com Jamie Souef

    Love the tip, and a double listing is fantastic for your site, but a word of caution. Plugins such as headspace2 (great SEO plugin) user the wp_title(); function exclusively to display the title tags that you assign from within the headspace plugin page. This could effect the way your title renders out.

    Found that out the hard way – spent hours trying all different function combination to get headspace2 to work and all it needed was

  • http://haiku-poems-blog.blogspot.com/ kouji

    i’ve read about this as well. and i do see that in the serp results. now i just need to find a way to do this in blogger. :D

  • http://www.lyxia.org jbj

    @Jamie: Thanks for your great advice! But seems like you forgot the end of your sentence :p

    @koujie: I don’t know if this is possible on blogger, I never used this platform. You should definitely set up a WP blog!

  • http://www.maigretsblog.com/ Maigret

    Hi Jbj,

    you can also use a plugin All in One Seo Pack or Platinum Seo Pack which provides similar options without any modification in the code.


    P.S : I understand that “purists” person prefer to edit code. :D

  • http://www.lyxia.org jbj

    @Maigret: Thanks for mentioning All in one SEO Pack, which is one of the best WP plugin ever! Btw, I think that theme developers should provide users a SEO optimized title, even if All In One SEO Pack can do it: The more features your theme have, the best it will be :)

  • http://jamielesouef.com Jamie Souef

    Woops! I think i put in html and it filtered it out. It needed just (table)(?php wp_title();)(/table). Just replace the ( with the proper html tags :)

  • http://howtodatingonlinefree.com/ Anne

    Wonderful post and great tips. The post and comments helped me a lot. I saved this page for future reference. Thanks once again for sharing such a lovely information with us. :)

  • http://www.xlwealthdynamic.org/ Roger Hamilton

    Great post. Thanks for the tip.

  • http://www.camillejung.com/blog Camille JUNG

    Good and interesting post. I’ll use a plugin but it’s interesting to see the code.

    What do you think of the coment relish plugin ? I’ll do a post about it.

    See you,

    Camille JUNG.

  • http://www.lyxia.org jbj

    Hey young brother :)

    I never tried the comment relish pugin. If you’re looking for a killer SEO plugin, give a try to All In One SEO Pack, you won’t regret it!

    See you soon ;)

  • http://ampedtech.com Stan

    It is interesting to see how it is coded. I personally use All In One SEO Pack because it allows you to set the keywords and description meta tags as well.

  • http://www.freegamesystems.info Michael

    Great post. Saves me some time in having to write new code for the title. Your suggested titles, especially when it comes to the title of a blog post. Most of the focus is taken away from your post when put on the blog’s name and the word “wordpress” in the search engine results.

  • http://www.fourthfloormarketing.com Internet Marketing

    Great post, I have quite a bit of work to do myself in better optimizing my titles. I am using all-in-one-seo yet I typically don’t do enough market research the reap the full rewards of my blog posts as it stands now.

  • http://www.evawhite.com Eva White

    That makes so much sense. After all the effort one puts into SEO for the content and if one only used the title tag correctly it makes so much difference.

  • http://www.dollarshower.com Ajith Edassery

    Most important thing is to have H1 tag around the single post title. And another thing, on single post the keywords and page description should be appropriately chosen. All-in-one-SEO plugin can do this job pretty well and can increase your search traffic hitting single posts dramatically.


  • http://thisismyurl.com Christopher Ross

    Great advice! Optimizing your title tags is so important yet most themes ignore this critical piece of the puzzle.

  • http://www.peiprofit.com Make Money Blogging

    Thanks for the tips. I think most people are doing Main Keyword | Long Tail Keyword and I think this is a good trick too..

  • http://www.timelessinformation.com Armen Shirvanian

    I should pay more attention to this aspect as I don’t tend to notice what my mind goes for during a regular search. Keeping in mind that it comes out name/category/article will allow me to notice what others have set their conditions up as.

  • http://www.xbox3l33t.com Phil

    Always interested to hear more SEO related stuff – but my understanding was that keyword relevance was most important – therefore, if your blog name, category name and article title all have important relevant keywords in them – where’s the harm in them all appearing?

  • http://www.gagazine.com stellar

    This is a great help. tags should be powerful. i will try the code too.


  • http://directsalesinstitute.com.au/ Sales Training Programs

    Thanks for lovely tip.:)

  • http://convert-to.com/ Convert to

    Thank you for the code, it works perfectly. I use it in the comments.php instead for the line of text “If you would like to comment on …..” with tags getting some extra keywords.

  • http://www.lyxia.org jbj

    @Convert to: you’re right, this is a nice use of this code!

  • Pingback: 8 tips to enhance your WordPress blog SEO

  • http://azikuri.com Shoto Azikuri

    I used this code:
    but it wasn’t the best variant so i edit my header.php and use your code,
    thank you very much,

    Shoto Azikuri.

  • Pingback: 8个增强WordPress SEO效果的技巧 | 帕兰映像

  • http://www.0window.com/blog/ Catrin W

    Thanks for the share because it is very useful. I sometimes prefer self hard coded add-ins in wordpress more then plugins because they tend to overload already very big wordpress pages. And this is great replacement for SEO title plugins that are available.

  • http://www.modification.org loan modification

    Thanks for the tip on the plug-in, have you found wordpress or blogger (or any others) to more cooperative with your SEO strategies?

  • http://itsoke.com brandon alan scofield

    sir is it just for WP ? what about typad platform ?

  • http://freeipodsetc.co.uk iPod

    Personally I would use the All-in-one-seo-pack for WordPress. This allows you full control of your titles so you can optimize every page individually. It is easy to install too.

  • http://www.jointhealthreviews.com Joint Pain

    Cool tip,have already tried it , also doing some split testing, will send the results soon.

  • http://www.outsourcingseoindia.com/semservices/ DS

    Thanks Buddy, I found your site from http://delicious.com/tag/seo

    and really, it’s very helpful for me. as i changes my WP title.
    Thanks again dear.

  • http://www.dstudiobali.com/webdesign/busby-seo-test-page/ SEO Test

    Always interested to hear more SEO related stuff. And I’m realy love to find any tips how to code my wordpress and optimising the theme rather than using plugins :D

  • http://oksaa.com Popular Electronics

    Great tips. Thanks.
    Seems that Platinum Seo Pack is the way to go.

  • http://makmalcyber.com/category/blogging-tips/ Blogging Guide

    First i used Alll In One SEO Pack, but my friend suggest me to change to platinum seo.

    I din’t like the way the Platinum SEO appear on Google. Do have any suggestion?

    Which one should i used? Or it still have the same result..

  • http://scionnews.net Scion News

    Thank you very much. Since switching themes, I didn’t notice that my titles/descriptions had gone to hell… I’ll be sure to fix this at once!

  • http://www.allcrys.com steve

    SEO is very good to get best rank in search engine but need to spend long time to best result. Patient also is important thing and must do more study about the SEO optimizing. If you are really master on SEO its like you can easy success on what ever blog platform you create beside the wordpress

  • Pingback: Tips to enhance your WordPress blog SEO | CSS Experiments

  • http://www.DollarShower.com/ Ajith | Blog Money

    I started writing an SEO – Link building series last week… Some of the points discussed here will be of use to me to articulate it in beginners’ language.

    One of the common questions that was asked there is the difference between keywords, tags and categories ;)

  • http://www.hootsmart-optimisation.co.uk/consultant.html Seo Consultant

    Excellent pointers to keep in mind. Personally after many years of SEO, I think the best way is just to hardcode/rewrite the titles and just leave your Keywords in the title tag of that page and nothing more. For example, your KWord is “Weird Tshirts” your title will only need to contain “Weird Tshirts” . I’ve noticed this to be more useful for optimization.

  • http://bit.ly/1Nu2y2 andrew from florida

    Great pointer, I love to use the All in one SEO plugin, it’s been really helpful for managing multiple blogs and making sure the SEO principles stay in tact.

  • http://www.violaogospel.com RickVallen

    Save my day, thanks for sharing
    God Bless u

  • http://www.linkchili.com Bart

    Great Article, Thanks

  • http://amazooo.com V.C

    I’m newbie so I don’t know much about wordpress and how to SEO.
    Thank you for this post.

  • Pingback: WordPress SEO How to optimize the title tag for search engines | Uniform Stores

  • http://www.seolight-blogger.com SEO Tips

    I don’t quite remember, but doesn’t SEO-all-in-one plugin allows you to do the same stuff without editing header.php?

    It’s not a big deal to edit, but using a plugin could be less intrusive I think.

  • Pingback: 8 tips to enhance your WordPress blog SEO | Best Wordpress | rooteto.com - ErtuÄŸrul SAÄžLAM

  • oronm

    hi Jean, i checked your front page and i think you don’t have an h1 there at all. you start at h2 – first, i think that’s invalid html. second, i think you can put the site title and small description in an h1 and get a lot more attention in search engines.

    oron mizrachi

  • http://www.aurapreneur.com/ Ian

    Had some trouble adding the page titles for each post. Maybe my version of word press is newer. I downloaded the platinum seo plug in and everything worked fine. Thanks for your info, and SEO advice!

  • http://fotografguiden.no stein

    Great hack!

    A little tip if your blog’s got a static homepage;
    replace is_home() with is_front_page()

    This way you don’t get the static-page-title on your homepage.

  • Pingback: Tips to enhance your WordPress blog SEO | Dhrobonil

  • Pingback: 8 tips to enhance your WordPress blog SEO : sohbet chat dostluk arkadaslik sohbet odaları kameralı sohbet sesli chat kızlarla sohbet

  • Pingback: WordPress SEO with Consultant Craig Fifield | Murray Newlands - Marketing Blog

  • http://www.seocipher.com/basics/titletags.htm Fernando

    Thanks for the tips, everyone. But I have a question. I am using the “Page Meta” plugin for WordPress and I can’t figure out how to change the Title and Meta Description of my blog’s main page. I don’t want it to be just the name of my blog. That particular plugin works for entry pages but not archives or my main page. Does anyone have a tip for me? I’m not sure that stein’s tip will work for my site.

  • http://theneworder.net Jon

    Google makes it as tough as possible to get listed. Makes you hate Google doesn’t it?

  • http://www.youtube.com/watch?v=x5fWPcmo6uk Jamie

    This is very helpful. I hope there’s a Blogger or TypePad equivalent for this.

  • http://runbobrun.eu Wojtek ‘Bob’ Bobrowski

    Yeah, thx for code. This is what I was trying to do =)