-
-
Save seancojr/2439902 to your computer and use it in GitHub Desktop.
Modify post_types searched
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 | |
add_action( 'pre_get_posts', 'localtv_posts_and_pages_for_search' ); | |
function localtv_posts_and_pages_for_search( $query ) { | |
if ( $query->is_main_query() && $query->is_search() ) | |
$query->set( 'post_type', array( 'post', 'page' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment