1

I have added add_theme_support( 'title-tag' ); function in theme setup in my functions.php now it shows the title as:

title-WordPress

I would like it to be changed as follows:

title | WordPress
3

To change the title separator, you'll need to use this filter document_title_separator which was introduced since WordPress 4.4.0.

Here's how you can customize the separator:

apply_filters( 'document_title_separator', 'your_custom_separator' );
function your_custom_separator( $separator ) {

    $separator = '|';

    return $separator;
}

Hope this helps.

Updated Answer

add_filter( 'document_title_separator', 'your_custom_separator' );
function your_custom_separator( $separator ) {

    $separator = '|';

    return $separator;

}

I've tested this with Twenty sixteen theme.See code See working site

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.