问题描述
我想删除类别 &来自 WordPress URL 的标签库.我遇到过其他使用插件的帖子和解决方案.我想远离插件并从functions.php中找到解决方案.这将防止任何未来的插件更新或 WordPress 默认文件被更改.
I would like to remove the category & tag base from WordPress URL. I have come across other posts and solutions which used plugins. I would like to stay away from plugins and have a solution from within functions.php. This would prevent any future plugin updates or WordPress default files from being changed.
任何帮助将不胜感激.谢谢!
Any help would be appreciated. Thanks!
到目前为止,我已经尝试过这些解决方案:
I have tried these solutions so far:
- 此 htaccess 解决方案不起作用:http://mikepayne.co/2011/remove-category-base-from-url/
- 这些方法也失败了:http://www.askapache.com/wordpress/remove-category-wordpress-urls.html
推荐答案
如果要从 url 中删除 /category/
,请按照以下两个步骤操作:
If you want to remove /category/
from the url, follow these two steps:
- 转到设置>>固定链接并选择自定义并输入:
/%category%/%postname%/
- 接下来将您的类别基础设置为
.
保存它,您会看到您的 URL 更改为以下格式:http://yourblog.com/quotes/
Save it and you’ll see your URL changed to this format:http://yourblog.com/quotes/
(来源:http://premium.wpmudev.org/blog/daily-tip-quick-trick-to-remove-category-from-wordpress-url/)
这篇关于删除类别和来自 WordPress url 的标签库 - 没有插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!