How to control WordPress Search Behavior?
What you tried to use is broken. add_filter( ‘pre_get_posts’, ‘modified_pre_get_posts’ ); function modified_pre_get_posts( WP_Query $query ) { if ( $query->is_search() ) { $query->set( ‘post_type’, array( ‘page-home’ ) ); } return $query; } That function definition is not valid. You would have seen an error if you had debugging enabled. You need: add_filter( ‘pre_get_posts’, ‘modified_pre_get_posts’ ); … Read more