meta_query to check all custom fields

I have to use the meta_query argument so that it checks for a keyword in all available custom field values (in array format) saved for the object. The meta keys are different for every object, therefor I can’t use any static key.

This is something I want to achieve.

‘meta_query’ => array(
‘relation’ => ‘OR’,
‘key’ => ‘state’, // This is where I am lost
‘value’ => ‘mykeyword’, //Keyword to look for
‘compare’ => ‘EXISTS’ //If keword exists in value (array)

Can this be done using meta_query or do I need to use custom database query?

Read more here:: meta_query to check all custom fields

Leave a Reply

Your email address will not be published. Required fields are marked *