This code enables you to set a custom permalink structure to include your domain, the name of your custom post type, the name of the category and the post URL.
Example : If the name of your custom post type is CPT and the name of your category is blogging, the permalink structure will be :
https://example.com/cpt/blogging/post-url
You can use this code with any custom post type simply by swapping out all instances of cpt in the code with the name of your custom post type.
You can also use the categories you create for your custom post type with standard posts.
Here’s the code you can add to the end of your child themes functions file or custom code snippets plugin.
Here’s the 3 pages the code adds to your WordPress dashboard menu :
Once you save the code, go to your WordPress Dashboard > Settings > Permalinks and resave them. This will flush the rewrite rules.