Support

Account

Home Forums Front-end Issues Custom Queries and Relationship Fields

Helping

Custom Queries and Relationship Fields

  • Ok, this one is seriously baking my noodle.

    I’ve got a custom post type of “Program” and a custom post type of “Venue”.

    These are joined by a relationship field on the Program post type called “Location”.

    I want to query WordPress to find only the Venues that are attached to a Program. I think I could do it via the posts_where filter but I can’t figure out how to write the MySQL statement to get the venues.

  • You should just be able to say get_field( 'location' ) when listing out your programs and it should return an array of IDs or Post Objects (depending on the return value you selected for the Relationship field).

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Custom Queries and Relationship Fields’ is closed to new replies.