I am trying to show the featured posts in my theme, with a custom field mytheme_featured_post
which is 1 on the featured posts.
However it does not seem to filter the posts down to only the posts in the meta query.
// WP_Query arguments.
$featured = array(
'posts_per_page' => '5',
'meta_query' => array(
array(
'key' => 'mytheme_featured_post',
'value' => '1',
),
),
);
// The Query.
$featured_query = new WP_Query( $featured );
if ( $featured_query -> have_posts() ) {
while ( $featured_query -> have_posts() ) : $featured_query -> the_post();
the_title();
endwhile;
}
Update: This args are working as intended:
// WP_Query arguments.
$featured = array(
'posts_per_page' => '5',
'cat' => '1',
'meta_key' => 'mytheme_featured_post',
'meta_value' => '1',
);
functions.php
file for anypre_get_posts
filter. It might be messing with your queries.