acf-extended / ACF-Extended

🚀 All-in-one enhancement suite that improves WordPress & Advanced Custom Fields
https://www.acf-extended.com
238 stars 27 forks source link

Meta Query for User Roles field #119

Closed matbrady closed 11 months ago

matbrady commented 11 months ago

Describe the bug

Unable to query posts by a meta value that's created using a User Roles field

To Reproduce

Expected behavior

Should be able to query posts based on the value of a User Roles custom field. Instead no results are returned. Example query:

get_posts([
    'post_type' => $post_type,
    'posts_per_page' => -1,
    'status' => 'publish',
    'meta_query' => [
        [
            'key' => 'roles',
            'value' => ['administrator'],
            'compare' => 'IN'
        ]
    ]
]);

WordPress & ACF

WordPress version: 6.2.2 ACF Pro version: 6.1.7 ACF add-ons: N/A