从 WordPress 类别 URL 中删除类别库
我在互联网上寻找解决方案,尝试了一两个插件来从 wordpress url 中删除 /category/ 。
虽然其中一些插件很好,但类别链接仍然显示/category/。
我还尝试在永久链接设置的类别基本选项中放入 ./ 。
有谁知道我该怎么做,比如 php 搜索和替换或类似的事情?
I fished around the internet for a solution to this, tried a plugin or two to remove the /category/ from wordpress url's.
While some of these plugins are good, the category link still display's /category/.
Also I've tried putting in ./ in the category base options in permalinks settings.
Does anyone know how I could do like a php search and replace or something like that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
更清洁的解决方案:
A cleaner solution:
使用 WordPress 3.9.1(本文中的最新版本),我只需在主题的
functions.php
中添加一行...然后我打开 Settings >固定链接并点击保存。这似乎刷新了永久链接缓存并使其正常工作。
Using WordPress 3.9.1 (latest version as of this post) I simply added a single line to my theme's
functions.php
...Then I opened Settings > Permalinks and hit Save. This appears to flush the permalink cache and makes it work.
http://wordpress.org/extend/plugins/wp-no-category- base/ 并且它不会改变永久链接,因此删除它可以毫无问题地恢复结构。而且您不必更改核心文件。
http://wordpress.org/extend/plugins/wp-no-category-base/ and it doesn't alter permalinks, so removing it reverts the structure with no problem. And you don't have to alter core files.
https://wordpress.org/plugins/no-category-base-wpml/< /a> 是一个解决该问题并适用于当前版本 WordPress 的插件。
https://wordpress.org/plugins/no-category-base-wpml/ is a plugin that solves the problem and works with current versions of WordPress.