Last active
December 21, 2016 08:31
-
-
Save cadoo/9b06457bdf441de8c1d254d429dee211 to your computer and use it in GitHub Desktop.
WordPress search results types filter
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
/** | |
* Filter search results types | |
*/ | |
function filter_search_types( $query ) { | |
if ( $query->is_search ) { | |
$query->set( 'post_type', array( 'post', 'alarm', 'store' ) ); | |
} | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'filter_search_types' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment