Lego2012
12/13/2016 - 10:10 AM

Change The Separator in The Title Tag in WordPress

Change The Separator in The Title Tag in WordPress

<!-- http://wpcodesnippet.com/separator-in-the-title-tag-in-wordpress/ -->

<!-- So the best way to change the separator in the title tag is to use wp_title filter for modifying the output of the WordPress title function. You can page this following code snippet in your WordPress theme’s functions.php file. -->

<!-- change the title tag separators in WordPress -->
function wpcs_change_wp_title_separator( $title, $sep ) {
    <!-- Set new separator -->
    $sep = '-';

    <!-- Set new title with separator -->
    $title = str_replace( '|', $sep, $title );

    return $title;
}
add_filter( 'wp_title', 'wpcs_change_wp_title_separator', 10, 2 );

<!-- Upon adding the above code snippet, it will change the default page title separator “|” (pipes) with “-” (dashes). -->