Home Forums General Issues Get relation field before running wp_query


Get relation field before running wp_query

  • HI there,

    I have a website with CPTs “lpc_place” and “lpc_event”. Events are related to places with an ACF Relationship field.

    Places got many custom fields like address, opening hours, AND postcode but my events don’t have those informations because there are relation with the place where the event is.

    I need to make a search option with location and want to know if Is there an easy solution to get every postcode of event (related with places) before running a WP_QUERY ?

    if($_POST['postcode']) {
    	$post_code = $_POST['postcode'];
     	array_push($meta_query_array, array("??" => "??"; "??" => "??"));
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Get relation field before running wp_query’ is closed to new replies.