I’m trying to create a wp query that goes through posts and pages and only returns one (the most recent, being a post or a page). So far, I have this:
$conteudo_complexo = new WP_Query(array(
'post_type' => array('post', 'page'),
'posts_per_page' => 1,
'orderby' => 'date',
'order' => 'DESC',
'meta_key' => 'tipo_de_destaque_homepage',
'meta_value' => 'topoeditorial'
));
This is returning multiple pages…
What I’m looking for is something like: go through posts and pages and return only one post or page with that meta_value, whichever is the most recent one.
Note: The meta_key and meta_value is for custom fields.