I'm trying expand a custom user search in Wordpress; namely, I want to search the users by city, state and country, but these data are serialized. My example
meta_key: pie_address_3;
meta_value: a:6:{s:7:"address";s:18:"New York Street, 4";s:8:"address2";s:0:"";s:4:"city";s:5:"Venice";s:5:"state";s:7:"Vicenza";s:3:"zip";s:5:"36015";s:7:"country";s:5:"Italy";}
Here is what I'm trying to do:
$my_users = new WP_User_Query(
array(
'role' => $role,
'search' => '*' . $search . '*',
'search_columns' => array(
'user_login',
'user_nicename',
'user_email',
'user_url',
'display_name'
),
'meta_query' => array(
'key' => 'pie_address_3',
'value' => $search,
'compare' => 'LIKE'
)
));
But, when I type some country or city (which I know is associated with some user), the search result return nothing. How can I handle this? Thanks!
Aucun commentaire:
Enregistrer un commentaire