functions - Replacing termtaxonomy archive pages with search queries

admin2025-04-19  0

I've got a site with a very large number of custom taxonomies. The site uses FacetWP to allow uses to drill down through those taxonomies. Instead of sending users to taxonomy-{taxonomy}.php when they click a linked term/taxonomy, I'd like to send them to the search with that specific facet applied. FacetWP makes this very easy with query strings.

It seems silly to use wp_redirect() and have 301 redirects for hundreds and hundreds of items. Is there an easier way to programmatically replace what Wordpress considers the destination for term and taxonomy archives?

I've got a site with a very large number of custom taxonomies. The site uses FacetWP to allow uses to drill down through those taxonomies. Instead of sending users to taxonomy-{taxonomy}.php when they click a linked term/taxonomy, I'd like to send them to the search with that specific facet applied. FacetWP makes this very easy with query strings.

It seems silly to use wp_redirect() and have 301 redirects for hundreds and hundreds of items. Is there an easier way to programmatically replace what Wordpress considers the destination for term and taxonomy archives?

Share Improve this question asked Nov 30, 2016 at 20:16 Zachary ReeseZachary Reese 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

I'm not familiar with how FacetWP displays search results, but if it's using the default (or a custom) search.php template, you could use a template filter to hijack the default hierarchy. See the Filter Hierarchy section of the Template Hierarchy page for examples. If you want more specific help update your question to show how you'd do this via wp_redirect() and we can help switching out the method.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745063207a282824.html

最新回复(0)