CPT with custom permalinks based on another CPT a parent page
-
I have 2 Custom Post Types. One is “mt_location” and one is “mt_menu”.
So let’s say we add a location called Jefferson. The URL looks like this: mysite.com/location/jefferson.
Now, if we add a Menu, I _need_ the URL to be rewritten to look like: mysite.com/location/jefferson/menu-1 (<cpt location>/<parent location page>/<menu page>)
I’ve followed several different sites including this one: https://vocecommunications.com/blog/2010/11/adding-rewrite-rules-for-custom-post-types/ to get this working. I have the URLs being rewritten properly, but the pages 404 no matter what I change. The parent page is set as a custom field that uses the save_post.
I’ve posted the code to a gist here:
- The topic ‘CPT with custom permalinks based on another CPT a parent page’ is closed to new replies.