Search for: Log In Free Support [Support request] How To Remove Pages From Search Results But Now WooCommerce Products? Home › Forums › Support › How To Remove Pages From Search Results But Now WooCommerce Products? This topic has 1 reply, 2 voices, and was last updated 4 months, 2 weeks ago by Tom. Viewing 2 posts - 1 through 2 (of 2 total) Author Posts October 14, 2020 at 11:06 am #1489047 Jaime I am using the following code to remove the pages from my site search results: if (!is_admin()) { function wpb_search_filter($query) { if ($query->is_search) { $query->set('post_type', 'post'); } return $query; } add_filter('pre_get_posts','wpb_search_filter'); } It is working good and removing pages but products also… I want to keep the products… Please help me in this October 14, 2020 at 1:44 pm #1489233 TomLead Developer Lead Developer Hi there, Instead of this: $query->set('post_type', 'post'); Do this: $query->set('post_type', array( 'post', 'product' )); Let us know 🙂 Documentation: http://docs.generatepress.com/ Adding CSS: http://docs.generatepress.com/article/adding-css/ Ongoing Development: https://generatepress.com/ongoing-development Author Posts Viewing 2 posts - 1 through 2 (of 2 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In