I am trying to get the post meta with meta query where value is an array of key value pairs.
$user_id = '123';
$arr = array();
$arr['a'] => "somevalaaa" ;
$arr['user_id'] => $user_id ;
$arr['c'] => "somevalyyy" ;
Adding post meta
add_post_meta($review_post_id, 'key_of_post_meta', $arr );
Getting post meta (having user id same as $user_id) with meta query, where I am wrong ?
$args = array(
'post_type' => 'as_reviews',
'posts_per_page' => -1,
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => 'key_of_post_meta',
'value' => array('user_id'=>$user_id),
'compare' => 'IN',
),
),
);
$query = new WP_Query($args);
key
andvalue
in the query?