Created
June 5, 2020 09:26
-
-
Save wplit/3ebc8d64bae51f3db776a54951885d2a to your computer and use it in GitHub Desktop.
remove current post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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