Wp Meta query does not work while meta value does

638 Views Asked by At

I have two queries which I believed should both work because I believe they are exactly the same

The one is as follows ( Works perfectly, and gives me the posts I need )

$args2 = array(
    'post_type'  => 'vacancy',
    'meta_key' => 'full_or_part_time',
    'meta_value' => 'part_time',
)

The other one is as follow : ( Returns all posts, ignores the meta query )

$args2 = array(
    'post_type'  => 'vacancy',
    'meta_query' => array(
        array(
            'key'     => 'full_or_part_time',
            'value'   => "part_time",
        )
    ),
);

I cannot figure out why option two does not work. Any assistance will be greatly appreciated.

0

There are 0 best solutions below