Simple better titles for your WordPress website

First, make sure that your theme uses wp_title(). So go to your theme’s header.php and check so that it has the following set:

<title><?php wp_title(''); ?></title>

You’ll need the ” there as well to remove some default arrows that WP adds.

Next, add this to your functions.php:

/*  Site title
/* ------------------------------------ */
function alx_wp_title( $title ) {
	// Do not filter for RSS feed / if SEO plugin installed
	if ( is_feed() || class_exists('All_in_One_SEO_Pack') || class_exists('HeadSpace_Plugin') || class_exists('Platinum_SEO_Pack') || class_exists('wpSEO') || defined('WPSEO_VERSION') )
		return $title;
	if ( is_front_page() ) { 
		$title = get_bloginfo('name').' - '.get_bloginfo('description');
	if ( is_front_page() && get_bloginfo('description') == '' ) { 
		$title = get_bloginfo('name');
	if ( !is_front_page() ) { 
		$title .= ' - '.get_bloginfo('name');
	return $title;
add_filter( 'wp_title', 'alx_wp_title' );

This will results in the following simple but good site titles:

  • On front page: Site Title – Site Description
  • On other pages: Default WP Page Title – Site Title

If you want to change the separator, just replace the two instances of “-” in the code with for example “|”.

Of course there are way more advanced methods and SEO plugins out there, but this is if you just want to keep it neat and simple.

Written by:Alexander Agnarson

3 Responses

  1. Mohammad says:

    Thanks for this codes

  2. Kat says:

    How do you change the fonts? I am a WP-newbie! Thanks.

    • Cat says:

      I used Custom CSS like the example below. There might be a better way, but this worked for me.

      @import “”;

      /* override: fonts
      /* ———————————— */
      body, input, textarea, button, select, label {
      font-family: “PT Sans”, Arial, sans-serif;

Leave a Reply

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