Home Forums ACF PRO querying multiple post relationships?


querying multiple post relationships?

  • Hi- i’ve got a bit of a tricky question here. what i’ve got is 2 custom post types i’m trying to link. One, lets call it Seminars has an ACF post object field called ‘speakers‘ allowing you to select Multiple posts from the second post type- ‘Speakers‘ and returning the post IDs.
    this part works fine, I can retrieve linked speakers and display them in the single ‘Seminars‘ post template as expected. Here’s the tricky part.

    what i want to do in the single post template for the ‘Speakers‘ post type, is to get the ID of the current post (easy enough) and run a query on the ‘Seminars‘ post type to check for posts where the current post’s ID is selected in the ‘speakers‘ field. The issue i’m having is that because it’s a multi-select, it doesn’t seem to work when there’s more than one entry.

    i’d got this far:

    $id = $post->ID;
                 $args = array(
                     'meta_key' => 'speakers',
                     'meta_value' => $id
                 $eventquery = new WP_Query($args);
                 if ($eventquery->have_posts()) :
        while ($eventquery->have_posts()) :
  • You need to do a “LIKE” meta query. See the single-location.php section of

  • Thanks John! that looks like what i’m after- thanks for the headsup- will give it a crack this afternoon and see how i get on..

  • @John Huebner- absolute legend, that worked like a charm!

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

The topic ‘querying multiple post relationships?’ is closed to new replies.