Hello,
I use ACF Pro and CPT UI. We have overall 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. 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 URLs:
/event-1/workshop-a
/event-1/workshop-b
/event-2/workshop-c
/event-2/workshop-d
Any ideas how to do this? Many thanks
Thank you John. That seems to be code I’d enter in my theme (in functions.php
), which is a sad way to set up the base structure of a website. A classic WP issue.
I’d prefer to do this using plugins, so this core functionality doesn’t become theme-dependent. Can’t CPT UI and ACF Pro manage this simple things needed in any website other than a blog? Welcome other recommendations for a plugin. Thanks!
I don’t know of any plugins that will alter the permalink structure in this way. ACF is built to manage custom fields and doesn’t do anything at all about managing post types. CPTUI is built to let you define post types but not the relationships between them. Even plugins that I know of that let you manage relationship between post types do not alter the permalink structure in the way you’re looking for. Actually, there are been a few that have attempted this, but I’ve seen these come and go and they have never been reliable enough to depend on for the long hall or they have limitations that can cause a site to break if not used within those limitations.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.