php - Get user id from wp_usermeta table -


i have stored term ids in wp_usermeta table. want user id term id match user meta key 'location' value. have tried below query doing nothing.

global $wpdb;     $term = get_queried_object();     $query = $wpdb->get_results("select user_id wp_usermeta meta_key='location' , meta_value %s",'%'.$term->term_id.'%'); 

enter image description here

try this, not passing value correctly

$query = $wpdb->get_results("select user_id wp_usermeta meta_key='location' , meta_value '%s,%".$term->term_id."%'"); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -