How to restrict the search fields for a specific post type

I figured it out, thanks function my_search_pre_get_posts($query) { if($query->query_vars[‘s’] != ” && is_search()) { if(absint($query->query_vars[‘s’])) { $query->set(‘p’, $query->query_vars[‘s’]); $query->set(‘post_type’, [‘property’]); // Reset the search value $query->set(‘s’, ”); } } } // Filter the search page add_filter(‘pre_get_posts’, ‘my_search_pre_get_posts’); A very good learning of WordPress functionality.