In short i want get meta values from usermeta table but the meta value is in serialize array form,
these values are post ids actually, this is my working code for single meta value, i want multiple values from serialize array in meta_value
$user_id = get_current_user_id();
$key = 'classes';
$single = true;
$user_last = get_user_meta( $user_id, $key, $single );
$user_last;
$query_args = array(
'posts_per_page' => $output,
'post_status' => 'publish',
'post_type' => 'stm-courses',
'meta_query' => array(
array(
'key' => 'classes',
'value' => $user_last,
'compare' => 'LIKE'
)
)
);
print_r( $query_args ); echo "string";
the single meta value is working fine but not multiple values
the below is the output of the above query
Array ( [posts_per_page] => 3 [post_status] => publish [post_type] => stm-courses [meta_query] => Array ( [0] => Array ( [key] => classes [value] => Array ( [0] => 5033 [1] => 5034 ) [compare] => LIKE ) ) ) string
and in database the value for meta_key classes is stored something like this
a:2:{i:0;s:4:"5033";i:1;s:4:"5034";}
the values are dynamically changeable so i need something dynamic logic,
Thanks in advance, pls suggest me any good idea how i do this
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…