Support

Account

Home Forums General Issues Query relationship without id Reply To: Query relationship without id

  • If only 1 value in relation field :

    $city_id = $bnb_ville[0]->ID;
    if it could be more than 1 value :

    $city_id = [];
    foreach ($var as $post) {
    $city_id[] = $post->ID;
    }
    $bnb_ville is the variable for get_field() !