Passer la navigation

[Résolu] Predefined search and/or taxonomy archives

This support ticket is created Il y a 4 années et 8 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Fuseau horaire du supporter : Asia/Kolkata (GMT+05:30)

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

Dernière mise à jour par fabriceS Il y a 4 années et 7 mois.

Assisté par: Minesh.

Auteur
Publications
#1880201

Hello

On my real estate website I add some environment taxonomies like "Mountain", "Sea", "City". (the slug of this one is "area")
I have other custom taxonomies.
I'd like to deactivate all custom taxonomies archives. I saw a few support posts about that but or it's hidden links or I can adapt it to my case.

Actually it's well redirected too a 404 page when I type
lien caché

but I want to avoid the archives of lien caché

And so on for the other taxonomies...

Thank you for your help.

#1880219

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

To restrict taxonomy archive pages, Can you please try to add the following code to your theme's functions.php file
or
"Custom Code" section offered by Toolset:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

add_action('pre_get_posts', 'func_restrict_or_kill_taxonomy_archive_area');
function func_restrict_or_kill_taxonomy_archive_area($qry) {
 
    if (is_admin()) return;
 
    if (is_tax('area')){
        $qry->set_404();
    }
}
#1880221

My issue is resolved now. Thank you!

#1880241

Ooops, another "related" question...

I created a search form with multiple selectors. One of them is a checkboxes list with these "area" criterias.

I'm happy you help me to deactivate the wordpress archives. Actually I'dlike to create a link in my menu going to my search page.

For the menu item "mountain" I'd like to preselect the attribute in order to display my general search view with "mountain" checkbox already checked so the user see only the items with the taxonomy "mountain" and have the other checkboxes unchecked. (so the user still have the possibility to make a different choice.

Les nouveaux fils créés par Minesh et associés à celui-ci sont repris ci-dessous :

https://toolset.com/fr/forums/topic/split-predefined-search-and-or-taxonomy-archives-filter-view-with-taxonomy-term/

#1880255

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

As per our support policy, we entertain only one question per ticket.

This will help other users searching on the forum as well as help us to write correct problem resolution summery for the original issue reported.

I've split the ticket and we will communicate there for your additional question. You are welcome to mark this ticket resolve.

#1880291

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Please feel free to mark resolve this ticket. 🙂

#1883777

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Can you please mark this ticket resolved so I can add resolution summery.

#1883819
Screen Shot 2020-12-22 at 11.36.49.png

Hi Minesh

I did it already a few days ago but here is what the system is giving me

#1883835

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

You have to add some another reply, for example "Glad to see that issue is resolved" when you try to mark resolve ticket.

#1883857

Thank you very much for your help !