Change title slug or separator in WordPress

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

    $separator = '|';

    return $separator;

}