自定义帖子类型重写

时间:2019-04-29 14:30:18

标签: wordpress

我有一个名称为Landing Page的自定义帖子类型,我想从URL中删除CPT的内容。例如:

默认WP行为:http://somedomain.com/landing-page/test/

需要的网址:http://somedomain.com/test/

要实现此目的,我将register_post_type函数与以下重写参数一起使用:

解决方案1:

'rewrite' => array('slug' => '/','with_front' => false),

解决方案尝试2:

'rewrite' => array('slug' => false,'with_front' => false),

但是,它不起作用。谁能帮我解决我的问题?预先感谢!

0 个答案:

没有答案