In the codex it says its possible to do get_users() with multiple meta keys by using the meta_query parameter but it doesn’t explain how. Can someone give me an example?

1
1

As it mentions in the Codex page for get_users, it works the same as a WP_Query meta_query, see that page for full arguments list and examples.

$args = array(
    'meta_query' => array(
        array(
            'key' => 'some_key',
            'value' => 'foo',
            'compare' => '='
        ),
        array(
            'key' => 'another_key',
            'value' => array( 'bar', 'baz' )
            'compare' => 'IN'
        )
    )
);

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *