Wordpress类别URL路径更改

时间:2014-04-17 20:25:33

标签: php wordpress categories

我有一个帖子列表,每个帖子都分配给一个或多个类别。

当我查看Category1&page 39页面中的帖子列表时,URL路径为:

url.com/Category1

但是我的帖子属于第1类和第2类。当我点击该帖子时,网址路径会更改为url.com/Category2/postName

我的问题是如何制作它以便在我查看Category1中的帖子时,路径将保留url.com/Category1/postName而不是更改为其他标记的类别。

1 个答案:

答案 0 :(得分:0)

根据官方WordPress documentation

   When you assign multiple categories to a post, only one can show up in the permalink. The categories are ordered alphabetically. In each group of sub-categories the order will also be alphabetical. (see Manage Categories). The post will still be accessible through all the categories as normal.

因此,每当您为单个帖子分配多个类别时,WordPress会自动选择其中一个类别来创建帖子URL(请记住,这些类别按字母顺序排序,选择将基于相应的位置)。

您可以通过始终为帖子分配单个类别来避免这种情况。