Skip to content

Instantly share code, notes, and snippets.

@wplit
Created June 5, 2020 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wplit/3ebc8d64bae51f3db776a54951885d2a to your computer and use it in GitHub Desktop.
Save wplit/3ebc8d64bae51f3db776a54951885d2a to your computer and use it in GitHub Desktop.
remove current post
<?php
add_action('pre_get_posts','remove_current_post');
function remove_current_post($query) {
$current_post = get_the_ID();
$query->set('post__not_in', array($current_post));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment