Search bar for page that searches only particular page IDs
You can try to modify your filter like this function pregetposts_forspecificpage($query){ if(!is_admin() && $query->is_main_query() && is_search()) { $query->set(‘post_type’, ‘page’); $query->set(‘post__in’, array(22103,22121)); } } Edit : added !is_admin() because we only want to alter the query in the front. $query->is_main_query() to be sure that we are altering the main query. Replaced $query->is_search by is_search() Also, you … Read more