Home Forums Add-ons Gallery Field Gallery field return images IDs Reply To: Gallery field return images IDs

  • There is no setting for the gallery. It returns an array of image arrays. If you want to only return an array of IDs you can do

    $gallery = get_field('my_gallery_field', false, false);

    the 3rd parameter tells ACF not to format the value and this causes it to return just the list of IDs

    the 2nd parameter is the post ID, setting it to false just means the current post

    If you are trying to get the array of image arrays and acf is only returning the array of IDs anyway, this is almost always caused by a pre_get_posts filter that is incorrectly filtering the queries that ACF does to get the images. Usually because there is not sufficient logic to rule out these queries before making modifications.