Skip Navigation

[Resolved] Predefined search and/or taxonomy archives

This support ticket is created 4 years, 1 month ago. 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 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 9 replies, has 2 voices.

Last updated by fabriceS 4 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#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
hidden link

but I want to avoid the archives of hidden link

And so on for the other taxonomies...

Thank you for your help.

#1880219

Minesh
Supporter

Languages: English (English )

Timezone: 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.

#1880255

Minesh
Supporter

Languages: English (English )

Timezone: 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

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Please feel free to mark resolve this ticket. 🙂

#1883777

Minesh
Supporter

Languages: English (English )

Timezone: 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

Languages: English (English )

Timezone: 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 !