0

We use latest WP 5.2, and the super plugins Advanced Custom Fields Pro (ACF Pro) and CPT UI. In our website taxonomy, we need to have events, within which we have talks and workshops.

Example structure:

Event 1
  |__ Workshop A 
  |__ Workshop B 

Event 2
  |__ Workshop C
  |__ Workshop D 

We have therefore setup two custom post types: Events, and Workshops. We first create events. Then, when creating each workshop, we have a custom-field association with a related field and can thus create workshops within each event. In other words, each workshop is associated with a pre-created event. This works beautifully and ACF Pro is a stellar help.

However, the URLs created by Wordpress follow the custom posts as if they're unrelated:

/events/event-1 
/events/event-2 
/workshops/workshop-a
/workshops/workshop-b

What we'd like is to manifest the association in actual permalink URLs:

/event-1/workshop-a
/event-1/workshop-b
/event-2/workshop-c
/event-2/workshop-d

I found some questions on the site related to this, but they're either too localized, or deal with the wp_query inside already working permalinks, or have 0 answers. Any ideas how to set this up in Wordpress? Many thanks.

  • 1
    You could make the event CPT hierarchical and then make events the parent and workshops the children. This would set the slugs exactly how you want. – rudtek May 15 at 15:58
  • Thanks @rudtek. That sounds promising. For both Events (slug: events) and Workshops (slug: workshops) -- I have the 'Hierarchical' menu set to TRUE. In Workshops setting I write inside the Parent textbox: events. But this doesn't work. What should I do differently? – Khom Nazid May 15 at 18:46
  • Just to add, I'm speaking of the CPT UI plugin, not hardcoding all this custom post type and fields functionality into my singular theme. – Khom Nazid May 15 at 18:58
  • 1
    My suggestion was to get rid of the workshop CPT altogether. Create an event "event 1" save. Choose add new event, name it"workshop 1" then set it's parent to event 1. – rudtek May 15 at 21:16
  • Thank you Rudtek, but that is confusing to simple business users who will use the CMS. It's not a bad idea at all, just not very conceptually meaningful to enter workshops inside a parent Event. Will think about this. – Khom Nazid May 16 at 0:06

Your Answer

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

Browse other questions tagged or ask your own question.