Created
February 6, 2015 21:17
-
-
Save tommcfarlin/3dbbc246e98aa53aab1a to your computer and use it in GitHub Desktop.
[WordPress] A way to search user meta data without having to use a full word to retrieve results.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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