Yoast for WordPress: No space in page titles

26th Oct 2015
Yoast for WordPress: No space in page titles

Whenever I use the SEO plugin Yoast, I usually end up with the problem that the name of the WordPress site is added to the end of each page title, without a space before it.

I'm just getting the new site for Performance Verbier ready for launch, and the home page title was displaying as:

Verbier Ski School : Private Ski LessonsPerformance Verbier

However the snippet preview in WordPress admin was claiming the title would be just:

Verbier Ski School : Private Ski Lessons

I was very happy to have "Performance Verbier" added to the end - infact I preferred it (for this page) - but I wanted a space before it.

In the past I've tinkered and tried different separators and updated defaults etc. and eventually ended up with something presentable. But this time I just wanted to get to the bottom of the issue as I was sure I couldn't be the only one with this issue and there must be a solution - it must just be that I was doing something wrong.

Now, despite over 10 years of developing for WordPress I've never actually installed Yoast myself, I don't think. So it's possible that what I'm going to say is cited in the docs - but if it is then I've known various developers miss this step out.

In header.php you need to remove this code:

wp_title(' - ', true, 'right');


And replace it with just:

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


Once I'd done this (which you can do via Appearance > Editor if you don't have FTP access / access to the server) the snippet preview in WordPress admin was accurate and I didn't have any annoying issues with spaces.



  • By Cyril 08/10/2016 21:07:47

    Thanks so much!!!!!

Leave a Comment

Submitting this form will create you an account on this site for submitting comments, raising disputes and other features as we add them. If you've already got an account you will receive an email asking you to confirm this comment is really by you!

Know a great web designer, developer or marketer?

Tell them to apply to join The Web Guild - it’s free for anyone who gets a company profile approved before the end of March! Read our How it Works page or sign up here!

<< Back to news