Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] A way to search user meta data without having to use a full word to retrieve results.
<?php
$users = array();
$args = array(
'fields' => 'all_with_meta',
'orderby' => $meta_key,
'meta_query' => array(
array(
'key' => $meta_key,
'value' => $meta_value,
'compare' => 'LIKE'
)
)
);
$user_query = new WP_User_Query($args);
$users = $user_query->get_results();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.