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

by Jean-Baptiste Jung. 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.

optimiser-titre-blog-wordpress.png

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.

Comments (57) - Leave yours

  1. Jamie Souef said:

    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

  2. jbj said:

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

  3. Maigret said:

    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

  4. jbj said:

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

  5. Anne said:

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

  6. Camille JUNG said:

    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.

  7. jbj said:

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

  8. Stan said:

    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.

  9. Michael said:

    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.

  10. Internet Marketing said:

    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.

  11. Eva White said:

    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.

  12. Ajith Edassery said:

    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.

    Cheers,
    Ajith

  13. Armen Shirvanian said:

    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.

  14. Phil said:

    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?

  15. Convert to said:

    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.

  16. 8 tips to enhance your WordPress blog SEO said:

    [...] 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. I had recently written a tutorial here at Cats Who Code to obtain a really SEO-friendly title tag. [...]

  17. 8个增强WordPress SEO效果的技巧 | 帕兰映像 said:

    [...] 在 SEO 的世界里, Title 标签是最重要的事情之一: 因为,标题在搜索引擎结果和社会书签网站里面都显示为一个链接。 一个好的Title 既能提升关键词页面排名,也有利于用户阅读。WordPress 默认的Title 并不算友好(除非你使用的是一些比较偏重SEO 的WordPress 主题),这是一篇教程,告诉你如何为你的WordPress 设置 SEO-友好的Title 标签 [...]

  18. Catrin W said:

    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.

  19. iPod said:

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

  20. DS said:

    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.

  21. SEO Test said:

    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

  22. Blogging Guide said:

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

  23. steve said:

    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

  24. Tips to enhance your WordPress blog SEO | CSS Experiments said:

    [...] 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. I had recently written a tutorial here at Cats Who Code to obtain a really SEO-friendly title tag. [...]

  25. Ajith | Blog Money said:

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

  26. Seo Consultant said:

    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.

  27. SEO Tips said:

    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.

  28. oronm said:

    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

  29. Ian said:

    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!

  30. stein said:

    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.

  31. Tips to enhance your WordPress blog SEO | Dhrobonil said:

    [...] SEO Tips, WP Security 1 – Optimize your title tag 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. I had recently written a tutorial here at Cats Who Code to obtain a really SEO-friendly title tag. [...]

  32. 8 tips to enhance your WordPress blog SEO : sohbet chat dostluk arkadaslik sohbet odaları kameralı sohbet sesli chat kızlarla sohbet said:

    [...] 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. I had recently written a tutorial here at Cats Who Code to obtain a really SEO-friendly title tag. [...]

  33. Fernando said:

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please respect the following rules: No advertising, no spam, no keyword in name field. Thank you!