permalinks - Change URL of posts and also Custom Post Type

Right now I have changed the posts url using the settings -> permalink i.e blog%postname% I have now added a CPT a

Right now I have changed the posts url using the settings -> permalink i.e /blog/%postname%/ I have now added a CPT and using the rewrite 'rewrite' => array( 'slug' => 'custom-posts' ), but the urls for this custom posts are now inherriting the /blog/ from the standard posts so the urls look like /blog/custom-posts/post-title-here when I just want it to be /custom-posts/post-title-here.

Anyone know of a quick fix to achieve this ?

Right now I have changed the posts url using the settings -> permalink i.e /blog/%postname%/ I have now added a CPT and using the rewrite 'rewrite' => array( 'slug' => 'custom-posts' ), but the urls for this custom posts are now inherriting the /blog/ from the standard posts so the urls look like /blog/custom-posts/post-title-here when I just want it to be /custom-posts/post-title-here.

Anyone know of a quick fix to achieve this ?

Share Improve this question asked Jun 3, 2020 at 10:14 KravitzKravitz 1313 bronze badges 1
  • Welcome to WordPress Development. I hope you find the answer(s) you are looking for. Our site is different from most - if you have not done so yet, consider checking out the tour and help center to find out how things work. – Matthew Brown aka Lord Matt Commented Jun 6, 2020 at 15:21
Add a comment  | 

1 Answer 1

Reset to default 2

Answer is to use 'with_front' => false in the rewrite array :)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742378603a4432688.html

相关推荐

  • permalinks - Change URL of posts and also Custom Post Type

    Right now I have changed the posts url using the settings -> permalink i.e blog%postname% I have now added a CPT a

    4小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信