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;
}