Hi Andreas,
Thanks for reaching out.
There is no such option to set only a few pages for search, but you can achieve that by adding the following code into your child theme functions.php file.
The following code will set the specific page id(s) when you search on your site, and the result will come up from those pages only.
function wpb_search_filter( $query )
{
if ( $query->is_search && !is_admin() )
{
$query->set('post_type', array( 'page' ) );
$query->set('post__in', array( '1594' ) ); // add your page id(s)
}
return $query;
}
add_filter( 'pre_get_posts', 'wpb_search_filter' );
Remember that the above code will work if copied as it is and don’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We do not provide support for custom codes that means we can’t fix it in case it conflicts with something in your site nor will we enhance it.
Note: Please find the article to locate the post or page id(s): https://theme.co/docs/how-to-locate-post-ids
Thanks