woogychuck
Member
Posted 2 years ago #
When calling the get_posts function, I'm look for all posts that have a CustomField named 'ShowNav' that has a value of 'false'
I have confirmed that there are multiple published posts with this key/value combination, but both of the following function calls return an empty array.
$postlist = get_posts('meta_key=ShowNav');
$postlist = get_posts('meta_key=ShowNav&meta_value=false');
$args = array(
'meta_key' => 'ShowNav',
'meta_value' => 'false'
);
$postlist = get_posts($args);
I'm actually using 2.9.2, but it wasn't an option in the select
woogychuck
Member
Posted 2 years ago #
Please disregard this, it was a user error on my part. I mistakenly thought this function would return posts and pages, when it only returns posts.
What about:
$args = array(
'meta_key' => 'ShowNav',
'meta_value' => 'false',
'post_type' => 'any'
);
or
$args = array(
'meta_key' => 'ShowNav',
'meta_value' => 'false',
'post_type' => array('post','page')
);
Is it possible to get_posts and filter them more than one meta key?
Is it possible to get_posts and filter them more than one meta key?