0

I want to search all users metadata that have meta value like "vivek" if the mata key are "submitted" and the meta value store in a serialized format

$args = array(
'meta_query' => array(
    array(
        'key' => 'submitted',
        'value' => 'vivek',
        'compare' => 'LIKE'
    )
)
);

$query = new WP_User_Query( $args );
1

As you said data is stored inside meta_value as serialized format. You can match your string among the serialized string like data.

$args = array(
'meta_query' => array(
    array(
        'key' => 'submitted',
        'value' => sprintf(':"%s";', 'vivek'),
        'compare' => 'LIKE'
    )
)
);

$query = new WP_User_Query( $args );

Hope this help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.