Created
November 22, 2013 03:30
-
-
Save JiveDig/7594348 to your computer and use it in GitHub Desktop.
// Include all custom post types in search
This file contains hidden or 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 | |
| // Include custom post types in search | |
| // @link http://thomasgriffinmedia.com/blog/2010/11/how-to-include-custom-post-types-in-wordpress-search-results/ | |
| add_action('pre_get_posts', 'include_post_types_in_search'); | |
| function include_post_types_in_search( $query ) { | |
| if ( $query->is_search ) | |
| $query->set( 'post_type', array( 'post', 'download' ) ); | |
| return $query; | |
| }; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment