[How to] Change Default WordPress Title Separator
Starting with version 4.4, WordPress allows you to easily change your title separator using a filter. This was previously done by either installing a SEO plugin or manually adding a title filter. But if you just want to change the default separator to something fancy, include following PHP file in your theme’s functions file and it will do the trick!
Filter to Change Default WordPress Title Separator
<?php
function kafka_document_title_separator( $sep ) {
return "//";
}
add_filter( 'document_title_separator', 'kafka_document_title_separator', 10, 1 );
Save this code in a file called filter-document_title_separator.php
and drop/upload it to your theme folder.
Then, add the following line to functions.php
to simply include it in your theme. You can follow my simple guide explaining how to edit functions.php on wordpress.
include_once( 'inc/filter-title_separator.php' );
This line goes to top of the functions.php
file generally, after the <?php
opening tag of course.
I hope you found this simple trick useful, Enjoy!