0%

wordpress"页面"加html后缀

不用插件手工添加代码到function.php中,代码如下:

1
2
3
4
5
6
7
8
// 页面链接添加html后缀
add_action('init', 'html_page_permalink', -1);
function html_page_permalink() {
global $wp_rewrite;
if ( !strpos($wp_rewrite->get_page_permastruct(), '.html')){
$wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html';
}
}

最后更新一下固定链接即可生效!