meta_query doesn't find value if custom field value is serialized
-
Have the following code:
$args = array( 'meta_query' => array( array( 'key' => 'my_meta_key', 'value' => $my_value, 'compare' => 'IN' ) ) ); $posts = get_posts( $args );
If
my_meta_key
is just a single value, this piece of code works perfectly, but when themy_meta_key
is a custom field which have multiple values (so it’s stored as an serialized object), it won;t work anymore.As far as I can see this is expected behavior when I take a look to the code, but shouldn’t this just work? ??
Or anyone solutions for this (without directly using a lot of SQL queries)?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘meta_query doesn't find value if custom field value is serialized’ is closed to new replies.