Skip to content

Instantly share code, notes, and snippets.

@mjones129
Last active January 30, 2024 19:42
Show Gist options
  • Save mjones129/6af721aaaf8f57b5d58da343aee05bba to your computer and use it in GitHub Desktop.
Save mjones129/6af721aaaf8f57b5d58da343aee05bba to your computer and use it in GitHub Desktop.
Exclude posts from WP_QUERY
<?
$args = [
'post_type' => 'any',
'post_status' => 'publish',
'order' => 'ASC',
'post__not_in' => [253, 236]
];
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post();
the_content();
endwhile;
endif;
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment