Created
December 28, 2015 02:32
-
-
Save nathaningram/68a8f9906df42d4efc00 to your computer and use it in GitHub Desktop.
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
| //Exclude Pages from Search | |
| function ni_search_filter( $query ) { | |
| if ( $query->is_search && $query->is_main_query() ) { | |
| $query->set( 'post__not_in', array( 10,11,20,105 ) ); | |
| } | |
| } | |
| add_filter( 'pre_get_posts', 'ni_search_filter' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment