Skip Navigation

[Resolved] Update custom post URL to include taxonomy

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by himanshuS 1 year, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2617159

I have CPT called 'Jobs'.

The jobs are posted in the following URL
siteurl/jobs/job-slug

I will be posting jobs of different categories and would like to change the URL based on job type taxonomy.

For example.
siteurl/jobs/product-management/job-slug1
siteurl/jobs/project-management/job-slug2
siteurl/jobs/marketing/job-slug3

How can I achieve this?

I would also like to create category pages for each job type that only shows jobs of that category ---
For example.
siteurl/jobs/product-management/
siteurl/jobs/project-management/
siteurl/jobs/marketing/

How can I achieve this?

#2617161

Hello,

No, there isn't such kind of built-in features within Toolset Types plugin or WordPress core.

1) Toolset Types plugin is using WordPress built-in function register_post_type() to create post types, see WP document:
https://developer.wordpress.org/reference/functions/register_post_type/#rewrite

You can not change the custom post type URL based on other taxonomy.

2) Toolset Types plugin is using WordPress built-in function register_taxonomy() to create taxonomies, in your case, it needs to setup same rewrite rule "jobs" as the custom post types, it will conducts unexpected result:

The same value is already used in permalink rewrite rules for the custom post type "jobs". Using it again can cause issues with permalinks.

So in my opinion, even it is possible with custom codes, but it is not recommended to setup the permalinks as you requested above.

#2617169

What if I do this
1. Create a job post called Product Management -- let us call it Post V1
2. Make is the parent post to all jobs that are related to product management
3. Create a new custom template for product management job i.e. Post V1
4. In the custom template, only show jobs from product management

This way the URL will change to
siteurl/jobs/product-management/job-slug1

and the siteurl/jobs/product-management/
custom post will be used as a category page.

Do you see issues with this?

#2617181

Yes, you are right, it should be possible with a hierarchical custom post type "jobs":
https://developer.wordpress.org/reference/functions/register_post_type/#hierarchical

You will get the URL links as you mentioned above.

#2617315

My issue is resolved now. Thank you!