Im using post meta to store some value. Im having the following in wp_postmeta table:
meta_key
mykey
meta_value
a:2:{i:0;s:1:"5";i:1;s:1:"2";}
I need to return posts which have meta_value of 2.
My query:
$args = array(
'post_type' => 'post',
'meta_key' => 'mykey',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'mykey',
'value' => '2',
'compare' => 'IN',
)
)
);
$the_query = new WP_Query($args);
But no posts returned... Where i made mistake?
'compare' => 'LIKE', 'value' => 's:1:"2"'
, but i don't think it will work..