page 页面链接后添加 .html 后缀

小白兔
21个月前

202 0

page单页面链接不会跟随后台设置的固定链接变化,需要通过方法处理添加

// functions.php
/* ----- 修改page链接后缀 start ---- */
    function custom_page_rules() {
        global $wp_rewrite;
        $wp_rewrite->page_structure = $wp_rewrite->root . 'page/%pagename%.html';	
    }
    add_action( 'init', 'custom_page_rules' );
/* ----- 修改page链接后缀 start ---- */

添加方法后需要在后台固定链接页面保存生效,page页面链接变更为:http://www.域名.com/页面名称.html

END

←上一篇

下一篇→没有了