WordPress 自定义分类、标签、页面的URL伪静态格式,加.html后缀:function custom_page_rules() {global $wp_rewrite;/** page页面自定义URL样式 **/$wp_rewrite->page_structure = $wp_rewrite->...
WordPress 自定义分类、标签、页面的URL伪静态格式,加.html后缀:
function custom_page_rules() {global $wp_rewrite;/** page页面自定义URL样式 **/$wp_rewrite->page_structure = $wp_rewrite->root . ‘page/%pagename%.html’;/** tag页面自定义URL样式 **/$wp_rewrite->extra_permastructs[‘post_tag’][‘with_front’] = ”;$wp_rewrite->extra_permastructs[‘post_tag’][‘struct’] = $wp_rewrite->extra_permastructs[‘post_tag’][‘with_front’] . ‘tag/%post_tag%.html’;/** category页面自定义URL样式 **/$wp_rewrite->extra_permastructs[‘category’][‘with_front’] = ‘category’;$wp_rewrite -> extra_permastructs[‘category’][‘struct’] = $wp_rewrite->extra_permastructs[‘category’][‘with_front’].’/%category%.html’;}add_action( ‘init’, ‘custom_page_rules’ );
修改后需要重新保存下固定链接的规则。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。