mercredi 1 avril 2015

Get user id from wp_usermeta table

I have stored the certain term ids in wp_usermeta table. i want to get the user id where the term id match with the user meta key 'location' value. i have tried it with below query but it is doing nothing.



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


enter image description here


Aucun commentaire:

Enregistrer un commentaire