I wrote Optimal Title three and a half years ago to help fix a blatant flaw in WordPress’s default usability and search engine optimization (SEO). Since then, the plugin has been downloaded by tens of thousands of people and written about by hundreds of bloggers. Soon, the plugin will become obsolete…
A Change in WordPress v2.5
As of the beginning of this year, a changeset was checked in to WordPress’s SVN repository which adds a “separator location” argument to the built-in wp_title() function. What that means, is that when WordPress v2.5 is released around March 10th of this year, users will be able to change the ordering of their HTML title tags without having to use a third-party plugin.
The developers decided not to change the default behavior of wp_title(), and instead added the additional argument to the function in order to prevent breaking existing themes that rely on the current behavior.
How to Make the Change
If you’re currently using Optimal Title and want to change your template back to using wp_title() after upgrading to WordPress v2.5 (and you should), here’s what you need to do…
Using the simplified example from the original Optimal Title article, you should currently have something like this in your theme’s header.php file:
<title><?php optimal_title(); ?> <?php bloginfo('name'); ?></title>
Just replace the function call optimal_title() with a call to wp_title('»',TRUE,'right'), and you’ll end up with something like this:
<title><?php wp_title('»',TRUE,'right'); ?> <?php bloginfo('name'); ?></title>
That’s it!
Parameters
The wp_title codex page won’t be updated until the next release, however, here is how wp_title() will work after WordPress v2.5 is out:
<?php wp_title('separator', display, 'seplocation'); ?>
- 'separator' – string – The text to place between portions of the page title, such as the blog name and the category. Defaults to
'»'(»). - display – boolean – Should the title be displayed (
TRUE) or returned for use in PHP (FALSE). Defaults toTRUE. - 'seplocation' – string – The location of the separator in relation to the title. All values default to the standard left position, with the exception of
'right', which will place the separator after the title rather than before.
I’m Glad
Even though it took so long to get this done, I’m glad WordPress finally came around to the idea and added Optimal Title’s functionality to the core. Regardless of whether or not you were using Optimal Title before, I’d highly recommend that all users make this simple change to their templates in order to take advantage of the many benefits that a proper title tag has to offer.
19 Comments
Thanks for this heads up.
P.S. There’s a typo in the webhost link in your footer.
Fixed, thanks!
Hi Aaron,
I found I had to be explicit with the arguments for wp_title() in 2.5 RC2
e.g.
wp_title(’»’,'TRUE’,'right’)
The method you posted above generated a parsing error.
HTH
Shawn
I just downloaded the latest version of Wordpress – I think it’s 2.3.3. Should I install Optimal Title’s still? March 10th has passed and they are not at 2.5 yet – so I’m guessing they haven’t remedied this SEO title issue?
Thanks!
Thanks for the heads up, I’ll update the entry to reflect that change…
Up until v2.5 is released, yes Optimal Title is still necessary. If you try one of the release candidates for v2.5 then the new changes have been included and you don’t need the plugin. They are currently on the second release candidate and I expect a formal release for v2.5 won’t be too far behind.
Thanks for posting this. After fumbling around for about 30 minutes, I found this article and had an elegant solution in about 30 seconds. Thanks!
Thans for the clear documentation.
In 2.5, I used wp_title(’|',TRUE,’right’) to replace optimal_title here:
Unfortunately, on non-home pages, the pipe still appears in front of the page title, so I went back to using Optimal Title.
I’m using 2.5 and triple-checked the change for typos.
the snippet is:
if ( is_home() ) { bloginfo(’name’); wp_title(’|'); } else { optimal_title(’|'); bloginfo(’name’); }
Hi,
I’m about to upgrade to Wordpress 2.5, and while beginning to look around for new plugin versions and stuff, I found my way here. I just wanted to say thanks for your time and for that cool plugin.
I feel stupid, but I am not able to get my title to change.
The title reads Rotheblog | (Title)
I inserted this line of code in the correct place, and expected to see (Title) | Rotheblog
What am I doing wrong? Is there a setting in the admin area I need to change too?
Nevermind, stupid error, ignore.
I thought it was a stupid mistake, but it wasn’t. I still couldn’t get this to work for me.
Then I remembered where it was set in the admin, in the All In One SEO plugin. So, do you even need to set this code up in the theme if you are using this plugin?
For both tbronson and Jeff, it might help for you to see what I actually use on this site now that I’m running 2.5.1:
I don’t know much about the All In One SEO plugin, since I’ve never used it. It may change the title for you dynamically so making the change in your theme won’t make any difference. I do know that some themes out there either include support for Optimal Title directly, or include code that does a similar thing in their header.php files, so you might have to poke around to see if the theme your using is doing something non-standard.
Hi Aaron, thanks for the plugin!
I just downloaded and activated the Optimal Title plugin on my site running WP 2.5 and seemed that everything works well without any problem.. I didn’t even have to change the header file. Check this out: http://www.lowongankerjakita.com/job-vacancies-at-hero-supermarket/
I currently have my permalinks and title set up with postid/postname.
Is it more SEO optimal to have it just be the postname without the postid?
I use this OT 3.0 on wp2.5.1 won’t make any difference as previous wp version.
Hacking a theme’s header.php is dirty work when I change another theme to use. Could you possibly make a new version of OT which can avoid the hack of header.php?
I have this nice plug- in in my Worpdress 2.6.2 : i need deinstall?
Many thanks
Say, There is a very long title that appears on home page that I’d like to change that I cannot find anywhere to make that change.
I believe that title was created using Optimal Title Tag, but not longer use that plugin.
Is it possible to reinstall some version of the plugin on 262 to see if there is some hidden entry for this that if I install the plugin will be able to change or delete ?
I never heard about Optimal Title before. Until now. So sorry for that ignorance.
I’m very glad your plugin is now functioning as a core feature. That’s a great news.
Now people use other plugin like SEO Title Tag and Platinum SEO Pack.