首页 网站建设 Wordpress 浏览内容
WordPress自定义页面链接添加html后缀
WordPress自定义页面链接默认是不带.html 后缀的
如果小伙伴们想让页面也像文章页面一样拥有后缀,那么这个方法可以帮你实现。
将代码添加到主题的 functions.php 即可:
1 2 3 4 5 6 7 8 9 10 11 | /** * WordPress自定义页面链接添加html后缀 * http://www.moyoo.net/12527.html */ function ivicos_html_page_permalink() { global $wp_rewrite; if ( !strpos($wp_rewrite->get_page_permastruct(), '.html')) { $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html'; } } add_action('init', 'ivicos_html_page_permalink', -1); |