Different structures of wordpress get posts

New Edit

How to select posts where ‘post_meta’ has one of $defaults key !

Read More
$defaults = array(
    'artist_139' = 139,
    'artist_125' = 125,
    'artist_165' = 165,
    'artist_189' = 189,
    'artist_149' = 149,
);
$followingposts = new WP_Query(array(
    'post_type' => 'songs',
    'meta_query' => array(
        array(
            'key' => 'myfield',
            'value' => $defaults,
            'compare'   => 'IN'
        )
    ),
));

And (get_field(‘myfield’) returns:)

 get_field('myfield') = array(
        'artist_139' = 139,
        'artist_165' = 165,
    );

Related posts