I tried using the WP_query
and get_posts
without success. I need to have a post based on the key/value pair of its postmeta
. This is my latest try:
<?php
$args = array(
'meta_query' => array(
array(
'key' => "team_leader_subscription_id",
'value' => 38
)
),
'post_type' => 'novathon-team',
'posts_per_page' => '1'
);
// run query ##
$posts = get_posts( $args );
$q=WP_query($args);
print "DEV: posts:<pre>"; print_r($posts);print_r($q); print "</pre>";
It's returning empty array although I know there exists a post which has postmeta team_leader_subscriptions_id
as key and 38
as value. Why is this hapening? I also tried using WP_query
with this same arguments in different forms and still nothing. What am I missing here?