0

I've got a custom post type of product and one of case study.

Each product has a series of related case studies. How in Wordpress can I relate these items?

I'm using CMB2 and a custom multiselect field that allows the user to select the related product for a case study. However, I'm not sure if this is the best way.

Also the page that lists all the case studies for a particular product is very much like an archive page so it would be nice to be able to access it via

/productname/casestudies

1

There are probably several ways to handle this. I would store the parent product ID for each case study as post meta data for the case study. You can then use a meta query to get all case studies for a product. To display the case studies archive page, add a rewrite endpoint to generate the /productname/casestudies rewrite rules. See this answer for how to load a different template for those requests.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.