Support

Account

Home Forums General Issues Get a list of posts where a custom field matches with the current ID Reply To: Get a list of posts where a custom field matches with the current ID

  • https://www.advancedcustomfields.com/resources/query-posts-custom-fields/ see the section on querying on array based values. Also see this guide https://www.advancedcustomfields.com/resources/querying-relationship-fields/

    
    $args = array(
      ...
      'meta_query' => array(
        array(
          'key' => '',
          'value' => '"'.$idArtist.'"',
          'compare' => 'LIKE'
        )
      )
    );
    

    See https://developer.wordpress.org/reference/classes/wp_query/ for more info on properly constructing queries.