Site icon Hip-Hop Website Design and Development

ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?

I am looking for a way to query users based on a user meta entry for an advanced custom field which has a given value and itself is from a given layout type.

For example, let’s say I have the following entries in the usermeta table for a user:

a_flexible_content_field_0_status = 'value here'
a_flexible_content_field_1_status = 'some value'
a_flexible_content_field_2_status = 'more value data'

Where a_flexible_content_field is a flexible content field that has different layouts, these layouts are stored in the a_flexible_content_field usermeta row.

a_flexible_content_field = [0 => 'layoutTwo', 1 => 'layoutTwo', 2 => 'layoutOne']

Note, that the mapping of index and layout differs form user to user.

Now, how can I get users who have an usermeta row of a layout subfield with a given value and the given layout.

For example: Select all users that have an ACF field flexible_content_field_%_status of the layout layoutTwo and a value of some value.

Thanks a lot!