Sauter la navigation

[Résolu] How to exclude page from Search results?

This support ticket is created Il y a 5 années et 12 mois. There's a good chance that you are reading advice that it now obsolete.

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/Karachi (GMT+05:00)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par toolset-dave Il y a 5 années et 10 mois.

Assisté par: Waqar.

Auteur
Publications
#1197411

Hello,

how to exclude page, which is set to be visible only to given roles, from Search results?

#1197758

Hi Dave,

Thank you for contacting us and I'll be happy to assist.

The Toolset Access or Types plugin doesn't include a built-in feature to filter out results from the main search results page.

But you can use "pre_get_posts" hook for this.
( ref: https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts )

The following link has a good example of its usage for search results:
https://wordpress.stackexchange.com/questions/271628/filter-the-query-only-for-the-search-results-page

I hope this helps.

regards,
Waqar

#1214215

Hi, I have found out that it is included in Relevanssi plugin, so it is solved now.