Created
February 25, 2015 08:07
-
-
Save ville6000/3cdb5d597eaa25db4b27 to your computer and use it in GitHub Desktop.
Exclude page from Wordpress search
This file contains hidden or 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
function your_theme_exclude_pages_from_search( $query ) { | |
$query->set( 'post__not_in', PAGE_ID_HERE ); | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'your_theme_exclude_pages_from_search' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment