Support

Account

Home Forums General Issues Querying users by custom field Reply To: Querying users by custom field

  • Yes there is. ACF stores fields on user forms in the usermeta table.

    The difficulty is that checkbox fields are arrays stored as serialized data. In order to do a user query you would need to use the “LIKE” compare method in the meta_query for the user query.

    something like

    
    'meta_query' => array(
      array(
        'key' => 'my_field',
        'value' => 'my_value',
        'compare' => 'LIKE'
      )
    )
    

    if you’re looking for more than one value then you’d need to look for each value with and ‘AND’ or ‘OR’ for the relation value, depending on what you want returned.

    https://codex.wordpress.org/Class_Reference/WP_User_Query