【问题标题】:Wordpress category URL path changesWordpress 类别 URL 路径更改
【发布时间】:2014-04-17 20:25:33
【问题描述】:

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

当我在Category1的页面查看帖子列表时,URL路径是:

url.com/Category1

但我有一个帖子同时属于类别 1 和类别 2。当我点击该帖子时,url 路径更改为 url.com/Category2/postName

我的问题是如何做到这一点,以便当我查看 Category1 中的帖子时,路径将保持 url.com/Category1/postName 而不是更改为其他标记的类别。

【问题讨论】:

    标签: php wordpress categories


    【解决方案1】:

    据官方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(请记住,类别按字母顺序排列,并且选择将基于相应)。

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

    【讨论】:

      猜你喜欢
      • 2018-11-15
      • 2014-02-28
      • 2011-03-16
      • 1970-01-01
      • 2018-11-07
      • 2014-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多