wp query – Multi-layered WP_Query


I’m trying to avoid creating additional custom field for one of the posts, and was wondering if there is a way to query WP DB to retrieve the necessary data.

I have 3 types of posts: Events, Programs and Locations. On the event post type, there is a custom field for program it is related to. On the program post type, there is a custom field for location.

I’m looking for a query, that can add to the single-location.php document, which will retrieve all the events in that location, without the need to create an additional custom field.

My logic was: get me all the events and filter all the events, where the related program, has a related location, which is the title of this post.

Would it be possible?

kal3js 10 months 2022-03-28T22:26:00-05:00 0 Answers 0 views 0

Leave an answer