Empty taxonomy / category redirects to subtaxonomy / subcategory
-
HI!
Found out someone was asking for this, and yet again Topic was closed! People, do not close topics when they are not solved.
Here is a solution, add following code to “wp” action in your plugin / theme:
if (is_tax("MY_TAXONOMY_NAME")) { if ($term = get_term_by("slug", get_query_var("term"), "MY_TAXONOMY_NAME")) { if (!$term->count && $subterms = get_terms("MY_TAXONOMY_NAME", array("parent" => $term->term_id))) { wp_redirect(get_term_link($subterms[0], "MY_TAXONOMY_NAME")); exit; } } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Empty taxonomy / category redirects to subtaxonomy / subcategory’ is closed to new replies.