Blog Change Separator Used in WordPress Title Tags
May 21, 2013 PHP, Plugins, WordPress Social Share
To change the separator symbol, defined in SEO Yoast by the %%sep%% tag, you’ll need to modify your theme’s header.php file. In between the <title> tags, add the wp_title WordPress function with your separator symbol in place of the pipe below.
<title><?php wp_title('|', true); ?></title>
The default for WordPress is the dash, but I prefer to use the pipe character. As you can see, the title tag for this post is Change Separator Used in WordPress Title Tags | Sliced in America with the new separator in place.
The true part of the function means to print out the result of the function (our final title tag) and not to send it to PHP. If we really wanted to, we could set it to false and store the result in a variable to make even more modifications, such as capitalizing every character using the strtoupper PHP function.
<title><?php $title_tag = wp_title('|', false); echo strtoupper($title_tag); ?> </title>
The definitive tutorial on Yoast SEO can be found on the official site.
Yoast SEO now includes an area to change the title separator without going through code.