要更改标题分隔符,需要使用此筛选器document_title_separator 从WordPress 4.4.0开始引入。
以下是如何自定义分隔符:
apply_filters( \'document_title_separator\', \'your_custom_separator\' );
function your_custom_separator( $separator ) {
$separator = \'|\';
return $separator;
}
希望这有帮助。
Updated Answer
add_filter( \'document_title_separator\', \'your_custom_separator\' );
function your_custom_separator( $separator ) {
$separator = \'|\';
return $separator;
}
我用216个主题测试了这个。
