| | |

Better SEO Page Title for WordPress

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

Table of Contents

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 (‘&raquo’)
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 '&raquo;' ; } ?>

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

plugin, search engine, seo, wordpress

Share this:

Similar Posts