w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Wordpress custom post permalink structure inside custom post permalink

You can customise the permalink for a custom post type, but it needs to be hardcoded in the rewrite parameter given to register_post_type. You could use categories to achieve the same thing though: set up a taxonomy for the first custom post type and then use the posts to create a custom taxonomy for the second CPT (i.e. the posts from the first CPT would become the categories for the second).

So you would add something like this pseudo-code to the edit page for the second CPT:

  1. get all posts of type 'CPT1'
  2. loop through them to create a list of checkboxes
  3. display in a metabox
  4. save the result

There are still hoops to be jumped through to get those URLs going to the right place, but it's a start.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.