Skip to content

Instantly share code, notes, and snippets.

@kisabelle
Created July 9, 2014 22:53
Show Gist options
  • Save kisabelle/895d0d2c45b9be1eac03 to your computer and use it in GitHub Desktop.
Save kisabelle/895d0d2c45b9be1eac03 to your computer and use it in GitHub Desktop.
Add Pages to Wordpress Search Results
function my_custom_search_filter( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array('post','page') );
}
return $query;
}
add_filter('pre_get_posts','my_custom_search_filter');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment