Better SEO Page Title for WordPress
Filed in: SEO Beginner, Weblog, WordPress, WordPress Plugins — March 28th, 2006By default, WordPress page title for single post is “BlogName » Blog Archive » Post title“. This is not a good page title in terms of SEO. I will show you how to create a better page title for WordPress blogs.
Why post title first?
A better page title is one with post title coming first before the site name. There are few reasons for doing so:
- Search engines read page title and use it as linking text in search results.
- Search engines only read first few words of page title.
- Search engines bold search query keywords in page title.
- People are interested on your post title, not your site name.
Which file to edit?
We will need to edit the “header.php” file in WordPress template folder. The line of code is:
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
bloginfo(’name’) shows your WordPress blog name.
wp_title() shows your post title with leading default separator text (’»’)
is_single() checks if the page is a permalink page (single post).
Change WordPress page title using wp_title template tag
We can still use the WordPress template tag wp_title() for reversed blog name and title. Simply replace the default line of code with the following code:
<title>
<?php wp_title(’ ‘); ?>
<?php if(wp_title(’ ‘, false)) { echo ‘–’; } ?>
<?php bloginfo(’name’); ?>
</title>
The output will be “Post title — BlogName“. You can define your own separator text by replacing the “–” in the code.
Example: <?php if(wp_title(' ', false)) { echo '»' ; } ?>
[Reference: WordPress Codex]
Change WordPress page title using Optimal Title plugin
The previous method is quite confusing for some beginners. For my sites, I am using a simple and easy wordpress plugin called “Optimal Title“.
Optimal Title is an old plugin but it is still working fine with current WordPress version. In fact, it is copy of wp_title() but it shifts the separator text from left side to right side.
How to use Optimal Title?
After installing the Optimal Title plugin, simply replace the default line of code in header.php with:
<title><?php optimal_title(); ?><?php bloginfo('name'); ?></title>
It will show “Post title » Blog Name” as page title. You can define your own separator text by adding parameter to optimal_title().
Example: <?php optimal_title(' -- '); ?>

WordPress 2 : Visual QuickStart Guide
Advance: Show blog description on the main page, but shows post title on single pages
The following code shows the page title as “Blog Description at Blog Name” at front page, but shows “Post title at Blog Name” on single pages.
<title><?php optimal_title('') ?> <?php if (is_home()) bloginfo('description'); ?> at <?php bloginfo('name'); ?></title>
bloginfo(’description’) shows your blog description.
My two cents
Perhaps you don’t care about the page title but trust me, it is a simple and effective way to increase your site ranking, and visitor traffic!
Popularity: 3% [?]
Comments Feed
TrackBack URL



March 28th, 2006 at 10:58 pm
We can use it in any version WP ?
or just for the 1.5.2 ?
March 29th, 2006 at 2:01 am
It should work with WP2 too. Test it and tell me your result pls
March 29th, 2006 at 7:33 am
the TITLE optimization is a must. h1 h2 are all useless. the TITLE is the main factor in getting traffic from search engine.
March 29th, 2006 at 8:41 am
Yes I made the template change directly to my blog using WordPress 2 and it works!
But don’t just cut and paste the text given by liew because WordPress changed the single quotes ‘ ‘ . Replace the quotes with true single quotes and it will work.
March 31st, 2006 at 2:17 am
If anybody interested, I’ve assemble a list of plugins for optimizing keywords and description tags too. Although the emphasis on keywords is less these days.
July 19th, 2006 at 2:47 am
Thanks LcF and Gaman, i will tried it out with my Blog…which will be up soon…hah!
August 31st, 2006 at 7:31 pm
alamak..!!!!something funky happened when i made the chages ,but i guess its got to do with what gilachess wrote.
December 1st, 2006 at 8:56 am
Just to be clear, the code looks like this — cut/paste did not work as the single quotes and the dash are not clean ASCII:
December 17th, 2006 at 6:06 am
Thanks! This worked amazingly. I hope I can get more hits now. I never thought about SEO with my wordpress, especially with the titles. My template must have been crummy to begin with. Thanks.
January 22nd, 2007 at 2:58 pm
I’ve written some instructions for changing the behavior of wp_title to produce better page titles. This includes a method for removing the separator and also for removing unwanted spaces.
http://www.ardamis.com/2006/07/03/optimizing-the-syntax-in-the-wordpress-title-tag/
April 21st, 2007 at 7:43 am
If I make these changes to my post titles..will I have to do 301 redirects or is the URL unaffected?
April 21st, 2007 at 2:42 pm
@Andrew Kelsall: you can keep the url (post slug) when editing the post title. no problem
April 21st, 2007 at 4:04 pm
Thanks, will get onto it soon…
July 16th, 2007 at 6:05 pm
hi Liew, remember me ?
I am helping my friend to setup a blog website recently, and I think this is a better solution for newbies… no programming knowledge require, just install the plugin. : http://wordpress.org/extend/plugins/all-in-one-seo-pack/
Cheers.
JAMES
July 18th, 2007 at 12:08 pm
@james: thanks for the plugin
July 26th, 2007 at 8:54 am
Great post. Thank you.
One item that DaveS touched on. You should change the example code to courier or code text because when I copied and pasted it into my web file and uploaded it there was an error because the browser didn’t understand the apostrophes.
Some beginners may not be aware of changing the apostrophes and get stuck.