Change The WordPress Page Title Separator Without A Plugin

The title separator in a webpage is the symbol or punctuation that separates different parts of the title that is shown in Google search results and in the top of the browser. For example:

There are lots of plugins out there that let you change the title separator in WordPress, but it’s actually really easy to do without a plugin. All you need is this really simple code snippet:

add_filter( 'document_title_separator', 'snippetpress_title_separator' );

function snippetpress_title_separator() {
 
    return '|'; // Change your separator here
 
}

This will change the title separator to the pipe symbol “|”. Just change this on line 5 in the code to whatever you want your separator to be.

Where to add the snippet?

Whichever snippet you choose to use, you should place it at the bottom of the functions.php file of your child theme. Make sure you know what you’re doing when editing this file. Alternatively, you can use a plugin such as Code Snippets to add the custom code to your WordPress site. If you need further guidance on how to add the code, check out our post on How to Add WordPress Snippets.