I have a custom field where the value contains a comma separated list of items (like:
test1,test2,test3), now I want to retrieve posts where the field contains one of the values, I have:
$query = get_posts( array( 'post_type' => 'custom_post', 'posts_per_page' => 11, 'meta_query' => array( array( 'key' => '_my_custom_field_key', 'value' => array('test1'), 'compare' => 'IN' ) ) ) );
And it fails. It works if I clear other values from the custom field so it only contains
test1 but not when it's in the comma-separated group.
In SQL I can use
FIND_IN_SET function to search for the value, but I'm trying to reply on core WP as much as possible and avoid custom SQL codes, it would be cool if it were possible.