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’ );
修改后需要重新保存下固定链接的规则。
阅读全文
原文链接:http://haojidi.com/?blog=wordpress-%e8%87%aa%e5%ae%9a%e4%b9%89%e5%88%86%e7%b1%bb%e3%80%81%e6%a0%87%e7%ad%be%e3%80%81%e9%a1%b5%e9%9d%a2%e7%9a%84url%e4%bc%aa%e9%9d%99%e6%80%81%e6%a0%bc%e5%bc%8f,转载请注明出处,如有侵权请立即删除。
评论0