首页 > 解决方案 > Wordpress // 删除 URL 的帖子类型 slug

问题描述

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

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

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

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

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

我怎样才能做到这一点?

标签: wordpresscustom-post-typeslugcustom-taxonomy

解决方案


如果您想在没有[cpt]自定义 post_type 的情况下使用自定义 slug,则需要在 args 数组中传递此值

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

在此更新您的永久链接之后


推荐阅读