【问题标题】:Wordpress // remove post type slug for URLWordpress // 删除 URL 的帖子类型 slug
【发布时间】:2019-03-15 19:50:17
【问题描述】:

我创建了一个 CPT 和几个应用于此 CPT 的自定义分类法。

目前我的网址如下(使用插件):

www.example.com/[cpt]/[taxonomy-term]/post

对于特定的 cpt,我想移至:

www.example.com/[taxonomy-term]/post

我怎样才能做到这一点?

【问题讨论】:

    标签: wordpress custom-post-type slug custom-taxonomy


    【解决方案1】:

    如果您想为自定义 post_type 使用不带 [cpt] 的自定义 slug,则需要在 args 数组中传递此值

    $args['rewrite'] = array(
         'slug'       => 'your-custom-post-type',
         'with_front' => false,
     ),
    

    在此更新后您的永久链接

    【讨论】:

      猜你喜欢
      • 2017-02-28
      • 2015-10-31
      • 1970-01-01
      • 2017-01-31
      • 2017-03-30
      • 1970-01-01
      • 2020-06-11
      • 2020-02-23
      • 2018-03-20
      相关资源
      最近更新 更多