I want to exclude two items (using their IDs) from an array that's retrieving images attached to the post: the post's thumbnail (featured image) and an image attached via Advanced Custom Fields.
I'm getting the first one's ID using
get_post_thumbnail_id() and this last one's ID using
'icon' is the
$selector of the custom field (essentially an image, that's being used as an icon). If you're not familiar with ACF's Documentation the relevant part about this is here.
I've scrapped everything irrelevant for demonstration purposes. This is what I have and where [I believe] my problem is at:
$var = get_children(array( 'exclude' => array( get_post_thumbnail_id(), get_field_object('icon')['ID']) ));
I'm thinking the result of
get_post_thumbnail_id is an integer, so it works perfectly, but the result of
get_field_object['ID'] is a string and that's why it doesn't work. If I could use something like
echo it would probably work.
I would love to understand where it's wrong and how to make this work, please.