WordPress 最理想的链接网址是文章页以「.html」为后缀,而分类目录以斜杠结尾是最基本的做法,当创建自定义页面模板时仍然想知要在末尾中添加「.html」为后缀, 创建您自己的页面实际上可以加速您的网站,荒岛本次带来 WordPress 页面链接末尾添加「.html」实现伪静态的教程,只要将下面的代码添加到主题的「functions.php」文件即可。
// 荒岛一座藏有宝藏的小岛 function html_page_permalink() { global $wp_rewrite; if ( !strpos($wp_rewrite->get_page_permastruct(), '.html')){ $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html'; } }
宝藏内容来自荒岛-https://x-imagine.com/wordpress-add-html-at-the-end-of-the-link.html 宝藏内容来自荒岛-https://x-imagine.com/wordpress-add-html-at-the-end-of-the-link.html
请按「Ctrl+D」收藏荒岛分享给好友,如您发现本文教程或宝藏链接已失效,请联系站长修正!
荒岛公众号
扫一扫关注

HDsoft27
公众号ID已复制,前往微信关注...
荒岛哔哩姬
扫一扫关注

ximagine
哔哩姬ID已复制,前往B站关注...