Include only Posts and Pages in Search - Used with The Events Calendar 5.0 New Designs are Active
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
/** | |
* Include only Posts and Pages in Search | |
* Used with The Events Calendar 5.0 New Designs are Active | |
* | |
* @param $query WP_Query | |
* | |
* @return mixed | |
*/ | |
function exclude_from_search($query) { | |
if ($query->is_search && empty( $query->query['tribe_suppress_query_filters'] ) ) { | |
$query->set('post_type', array( 'post', 'page' ) ); | |
} | |
return $query; | |
} | |
add_filter('pre_get_posts','exclude_from_search'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment