wordpress默认生成的 分类页面,标签页面,专题页面,他们的url结尾是不包含反斜杠的。
如:https://98seo.com/douyin
那怎么把地址变成 https://98seo.com/douyin/ 呢?
不需要插件,只需一段代码就行了。操作步骤如下:
1.找到主题根目录
wp-content—themes—你的主题文件夹—functions.php文件
2.在functions.php中加入代码。(可以考虑放到最后,方便管理)
// 分类目录、页面地址末尾添加斜杠
function nice_trailingslashit($string, $type_of_url) {
if ( $type_of_url != 'single' )
$string = trailingslashit($string);
return $string;
}
add_filter('user_trailingslashit', 'nice_trailingslashit', 10, 2);
3.保存刷新页面即可。
公众号:懒汉运营,关注获取免费资源。如若转载本文章,请注明出处:https://98seo.com/wangzhan/425.html