If you want to match them all, you have to add 'relation' => 'AND'
and check for each value separately:
$args = array(
'post_type' => 'post',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => '_some_meta_key',
'value' => 1,
'compare' => '='
),
array(
'key' => '_some_meta_key',
'value' => 2,
'compare' => '='
),
array(
'key' => '_some_meta_key',
'value' => 3,
'compare' => '='
),
),
);
To get around hardcoding this into the query, you can build your query args dynamically to add the relation and values based on the contents of your array:
$array_of_values_to_match = array( '1', '2', '3' );
// set some initial args
$args = array(
'post_type' => 'post',
'meta_query' => array(),
);
// if there's more than 1 value, add the relation arg
if( 1 < count( $array_of_values_to_match ) ){
$args['meta_query']['relation'] = 'AND';
}
// for each of the array values, add a meta query for that value
foreach( $array_of_values_to_match as $val ){
$args['meta_query'][] = array(
'key' => '_some_meta_key',
'value' => $val,
'compare' => '='
);
}
$posts = get_posts( $args );