Skip Navigation

[Resolved] Exclude pages from search results

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by matthewL-7 1 year, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2611665

Hi

Is it possible to only include a CPT in search results? I have setup a custom search archive page and set it to include “offers” my CPT. However I don’t want it to include posts or pages in search results.

Is this easily possible?

Thanks.

#2611797

Hello,

There isn't such kind of feature within Toolset plugin or WordPress core, you will consider custom codes, I have searched it in Google, and found some related posts, for example:
hidden link

More helps:
https://developer.wordpress.org/reference/hooks/pre_get_posts/
section "Exclude Pages from Search Results"

#2612141

I managed to solve this using Relevanssi, if anyone else looks at this. 🙂

Relevanssi lets you exclude pages/posts etc

#2612143

My issue is resolved now. Thank you!