Created
February 22, 2013 14:13
-
-
Save ckpicker/5013681 to your computer and use it in GitHub Desktop.
Exclude Events from Search
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
// search filter | |
function custom_search_filter($query) { | |
if ( !$query->is_admin && $query->is_search) { | |
$query->set('post_type', array('page','post') ); | |
} | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'custom_search_filter' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment