很多人喜欢把wordpress博客伪静态展现,文章伪静态规则设定好后台设置的固定链接设置好就好了…^0^~ 唯独新建的页面上没有带.html
如今找到了一个方法让页面链接也是.html结尾后缀

首先在主题的功能文件里functions.php添加以下代码,然后后台设置里的固定链接更新下就好了

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';
    }
}