admin管理员组

文章数量:1334670

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 :)

本文标签: permalinksChange URL of posts and also Custom Post Type