Answer the question
In order to leave comments, you need to log in
WP_query does not work correctly in front-page.php template. how to find the reason?
Greetings!
there is a code:
//посты которые исключить
$community_not_in_query = new WP_Query([
'post_type' => 'post',
'posts_per_page' => -1,
'editors' => 'community',
'fields' => 'ids',
'meta_query' =>
]);
$community_not_in = $community_not_in_query->posts;
$args = array (
'post_type' => array( 'post' , 'event'),
'posts_per_page' => 30,
'ignore_sticky_posts' => false,
'post__not_in' => $community_not_in
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) :
while ( $query->have_posts() ) : $query->the_post();
echo get_the_title().'</br>';
endwhile;
endif;
wp_reset_postdata();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question