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.'%');
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
Post a Comment