Purpose of this article is to demonstrate a simple technique for having separate, "SEO titles" for your posts. Normally article title is copied into the browser title plus usually the blog name. What we want is to have a simple way of specifying the browser title for our specific article and we do not want any fancy SEO plugins to do it.
Your current title structure in header.php of your theme might look something like this:
<title> <?php wp_title( '|', true, 'right' ); // Add the blog name. bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description"; ?> </title>
What we want to achieve is to use a custom field which we will call 'seotitle' and whenever you specify this custom field in your post we want to use the text you entered as our browser title. In order to do this we need to modify the above code so it checks for this custom field and uses it instead.
<title> <?php global $post; if (is_singular() && ($title=get_post_meta($post->ID, 'seotitle', true))) echo $title; else { wp_title( '|', true, 'right' ); // Add the blog name. bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description"; } ?> </title>
And that's all basically, from now on you can specify the browser title in the custom field.

Suggested reading:
- Do it Yourself: Optimize your WordPress Site Titles
- Do it Yourself: Optimize your WordPress Page Headings
- Tweaking WordPress: How to create a floating paragraph before your post
Posted in: SEO, WordPress
TAGS:add comment seo, add seo, add seo php, adding seo php, blog php seo title, how add name seo, how add seo, how add seo php, prelovac seo title, prelovac vladimir how, seotitles wordpress, title php seotitles title, without plugin seo wordpress, without plugins, wordpress seo without plugins, wordpress without plugins






13 Comments
I had no clue about this technique, I always used to update the tags with the help of plug-ins. Thanks a lot for sharing this with us
Very interesting SEO techniques. Thanks for sharing it
Nice. This helped me a lot. Thanks for sharing!
Wow! Thanks a lot for all that good information. I really appreciate it.
Great share...will be usefull for seo beginners
I have just started using WordPress for websites (as opposed to just a blog), and was looking into SEO issues like titles and meta tags. I am still trying to get a good grasp on it all, but shouldn't the custom field be named 'seotitle' in your example?
Thank you for sharing your knowledge!
Excellent tip thank you very much. I will have to incorporate this technique into my site as well. I have bookmarked your site and will definitely be returning.
Vladimir, it works on Home, Pages, Single pages, Archives, and Categories. But it won't work on frontpage paging. I need page title on title bar for the usability reason. Do you have any idea?
It is better to use the
single_post_titlefilter instead. Something like this infunctions.php:The approach would not allow for total control over the title as blogname for example would be automatically added in most cases.
Yeah, for that you can use the
wp_titlefilter.That would not help either, as people often have title structure set as in my example )which is more or less coped from the twenty ten theme). The only way to have a proper SEO title control is the one in the example (although maybe not the most elegant)
I had no idea one could do this like that. Thanks for the tip, Vlad. And keep up the good work with all them plugins! :)