How do I make search results include ONLY pages, no posts?
You can enforce a post type per callback on pre_get_posts: is_admin() || add_action( ‘pre_get_posts’, function( \WP_Query $query ) { $post_type = filter_input( INPUT_GET, ‘post_type’, FILTER_SANITIZE_STRING ); if ( $post_type && $query->is_main_query() && $query->is_search() ) $query->set( ‘post_type’, [ $post_type ] ); }); If that still includes other post types, you have a second callback registered on … Read more