Limit WordPress Search results to Custom Post Type (and dont break your app)
So recently I was asked to limit search results to a particular custom post type, for example a woocommerce product, here is how I did it: [dt_code] // Change search function globally to search only post, page and portfolio post types function prefix_limit_post_types_in_search( $query ) { if ( $query->is_search ) { $query->set( ‘post_type’, array( ‘product’ […]
Limit WordPress Search results to Custom Post Type (and dont break your app) Read More »