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
/* Exclude some pages from search */ | |
function gp_search_filter( $query ) { | |
if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) { | |
$query->set( 'post__not_in', array( 39,41 ) ); // add page ID's | |
} | |
} | |
add_action( 'pre_get_posts', 'gp_search_filter' ); |