0

I have a page, say streets, which is a static page and has the slug example.com/streets/, and I want to have many single streets under it. Let these streets be called streetdetails, so a single street detail would be example.com/streets/streetdetails/1.

When I create a posttype with Custom Post UI, I always get just top level slugs, such as example.com/streetdetails/1 and I cannot use the frontbase option either, as this is blog and will create false slugs.

How can I get that page -> posttype setup, that will put a posttype hierarchically under a page slug?

3
  • i think this what you searching for wordpress.stackexchange.com/questions/181134/… , sorry for my poor english
    – crozten
    Sep 17, 2015 at 11:28
  • Use 'rewrite' => array( 'slug' => 'streets/streetdetails', 'with_front' => false ) in your register arguments. Make sure to re-save permalinks in the admin after making the code change. Sep 17, 2015 at 12:16
  • @TheDeadMedic Thanks, that worked. If you add this as answer, I will choose it as the solution.
    – mcbetz
    Sep 21, 2015 at 10:13

1 Answer 1

3

You need to alter your rewrite arguments in your register_post_type() call:

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

Make sure to re-save permalinks in the admin after making the code change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.