Change title slug or separator in WordPress

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)