I'm trying to get posts which have applied the meta value trainees
.
$args = array(
'posts_per_page' => -1,
'orderby' => 'post_date',
'order' => 'DESC',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => 'enterprise_on_page',
'value' => array( 'trainees' ),
'compare' => 'IN',
),
),
);
$enterprise_posts = get_posts( $args );
In my meta-field with the key enterprise_on_page I have stored an array() previously like update_post_meta( $post_id, 'enterprise_on_page', array('trainees', 'staff') );
.
If I call var_dump(get_post_meta($post->ID))
I get the following output:
'enterprise_on_page' =>
array (size=1)
0 => string 'a:2:{i:0;s:8:"trainees";i:1;s:7:"staff";}'
How can i modify my query so that only posts with meta-value trainees
are shown. By now I don't get any posts.