testdocs

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

按照百度搜索资源平台《百度搜索网页标题规范:让标题回归标题本身》百度官方文档参考,如果WordPress标题里出现不规范“&#8211”这是不符合SEO规范,而我们要做就是把正常”-“被搜索引擎正常识别。

目前有三个办法解决:

1.调用remove_filter函数来移除wptexturize调用

remove_filter('the_title', 'wptexturize');

2.停止wptexturize转义任何字符

add_filter( 'run_wptexturize', '__return_false' );

2.阻止title中“-”被转义成“& #8211;”

remove_filter('the_title', 'wptexturize');
remove_filter('wp_title', 'wptexturize');
remove_filter('single_post_title', 'wptexturize');
add_filter( 'run_wptexturize', '__return_false' );

如果你发现有其他办法,请留言给我们哈。

posted on 2022-11-16 12:52  testdocs  阅读(144)  评论(0编辑  收藏  举报