Sauter la navigation

[Résolu] Excluding content from site search results / archive

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

I just came across this tickbox setting on post type -

exclude_from_search
Whether to exclude posts with this post type from search results.

Would this exclude items from the websites search?

Solution:

The option "exclude_from_search" works for wordpress built-in search page, see document:

https://codex.wordpress.org/Function_Reference/register_post_type#exclude_from_search

Whether to exclude posts with this post type from front end search results.

There isn't such kind of feature to include/exclude in web/google search, you might consider creating your custom robots.txt file:

https://support.google.com/webmasters/answer/6062596?hl=en

Relevant Documentation:

https://codex.wordpress.org/Function_Reference/register_post_type#exclude_from_search

This support ticket is created Il y a 6 années et 1 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/Hong_Kong (GMT+08:00)

Marqué : 

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

Dernière mise à jour par leilaG Il y a 6 années et 1 mois.

Assisté par: Luo Yang.

Auteur
Publications
#1149986

Following on from closed ticket #1138852

I just came across this tickbox setting on post type -

exclude_from_search
Whether to exclude posts with this post type from search results.

Would this exclude items from the websites search?

We have some content types that we would like to:

Type 1. Exclude from website WordPress search and exclude from web/google search
Type 2. Exclude from website WordPress search and include in web/google search

How do we achieve this?

#1150405

Hi,

The option "exclude_from_search" works for wordpress built-in search page, see document:
https://codex.wordpress.org/Function_Reference/register_post_type#exclude_from_search
Whether to exclude posts with this post type from front end search results.

There isn't such kind of feature to include/exclude in web/google search, you might consider creating your custom robots.txt file:
lien caché

#1153037

My issue is resolved now. Thank you!

I used this code - lien caché