Exclude in search post and include only 3 pages
you’re using $query->set(‘post_type’, ‘post’); to only include posts. What you can do is make it an array to include the post type and those specific page IDs you want. Here’s an example code: function custom_search_filter($query) { if ($query->is_search() && !is_admin() && $query->is_main_query()) { $query->set(‘post_type’, ‘post’); // Add the IDs of the pages you want to … Read more