1

The HTML output of all my WordPress pages has a blank space at the beginning of my <title> tag. You can see the effect here.

My header template contains this:

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

And roduces this:

<title> FAQ</title>

Any ideas on why this is happening?

7

It looks like your site's title is empty. Fill it out or try for example:

add_filter( 'wp_title', function( $title )
{
    return trim( $title );
} );

to remove the blank space in front.

For your setup, the following part of wp_title() is responsible for the blank space:

$title = $prefix . implode( " $sep ", $title_array );

So when you're on a single page, like FAQ, this will give you:

$title = ' ' . implode( " ", array( 'FAQ' ) );

or

$title = ' FAQ';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.