This solution enables you to create your own custom permalink structure for any custom post type ( CPT ).
Note: The entire code for creating CPT’s, Taxonomies and everything else you need is included in this post so all you need to do is copy, paste and swap out the names with your own.
This example assumes you have created 2 custom taxonomy types:
- the 1st named country
- the 2nd named region
Here’s a working example of what the permalink structure looks like for a single CPT:
http://example.com/golf-resort/scotland/st-andrews/british-open-golf-championship/
example.com – your domain
gold-resort = name of custom post type
scotland = country ( taxonomy )
st-andrews = region ( custom taxonomy )
british-open-gold-championships = entry site for single CPT
Here’s what the Edit Page looks like for each single CPT:
Once you add the code, you can create your own custom taxonomies and use them with one or more custom post types.
Here’s the code:
The code creates 2 CPT’s named golf course and golf resorts which include taxonomies for country and region.
Leave a Reply
You must be logged in to post a comment.