Exclude post types (products) from search

Posted in: Newspaper
Post count: 13

We are using woocommerce and newsletter for our site but do not want the products to be returner through a search.

First, we understand that woocommerce and wordpress have different ways they return search results, and have tried using wpsearch plugin to exclude product post types from search results, however nothing seems to be changing when using the search function in the theme.

Is newsletter using a custom script for search? If so, how would we go about excluding post types from results?

Post count: 20688

Hi,

The theme uses the default WordPress search, so the results you get in default WordPress would be the ones provided with the theme search function.

There is a plugin you could try, it should exclude the posts, products, pages you don’t want to appear in the search results
https://ro.wordpress.org/plugins/search-exclude/
Try to install it and check if it works properly.

Thanks

Post count: 13

Simon,

Thanks for your input.

After playing with it a bit more I realized the posts are getting excluded from the search results on the blog and result page returned, but the search bar and icon in the menu seems to be using a custom autofill script that returns all post or page types, even excluded ones.

Is there a way to change this

Post count: 20688

I just tried that plugin as well. Removed all products from the search
https://www.screencast.com/t/aax9Tah02B
They are not shown anymore in the search form autocomplete
https://www.screencast.com/t/Df65xIjjf
I then made them visible again
https://www.screencast.com/t/syZ0XgucK57B
They appeared in the search field as supposed to
https://www.screencast.com/t/QWp8wvf335c

So the same should work for you if you want to hide woocommerce products in the search autocomplete and results page.

Post count: 13

Nevermind. After giving the recommended plugin a shot and excluding the products specifically from settings they no longer are being returned by the live search.

Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.