Created
April 25, 2020 11:41
-
-
Save wpgaurav/5456517f56e59ad09ff14dd46b8dd162 to your computer and use it in GitHub Desktop.
Include custom post types in the search results.
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
<?php // MAKE CUSTOM POST TYPES SEARCHABLE | |
function searchAll( $query ) { | |
if ( $query->is_search ) { $query->set( 'post_type', array( 'site', 'plugin', 'theme', 'person' )); } | |
return $query; | |
} | |
add_filter( 'the_search_query', 'searchAll' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment