Modify search form with plugin
Here’s an alternative way to only make the product post type searchable, from a plugin code: <?php /** Plugin Name: Product Search Only **/ add_filter( ‘register_post_type_args’, function( $args, $post_type ) { $args[‘exclude_from_search’] = true; if( ‘product’ === $post_type && (bool) $args[‘public’] ) $args[‘exclude_from_search’] = false; return $args; }, 999, 2 ); Here we modify the … Read more