How do I get the URL var string for a particular taxonomy?
-
I have several custom taxonomies with filters, and I use shortened URL var strings (e.g. “sta” is the URL var string for a taxonomy called “name-status”). Is there a way to get the var string that corresponds to a particular taxonomy, in code? I want to be able to do something like this in a separate plugin:
$tax_queries = $wp_query->query_vars['tax_query']; foreach ($tax_queries as $tax) { $tax_name = $tax['taxonomy']; $tax_url_var = get_url_var($tax); // does a function like this exist? echo 'URL var for ' . $tax_name . ' is ' . $tax_url_var; // would output "URL var for name-status is sta" }
Is there a way to achieve this?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How do I get the URL var string for a particular taxonomy?’ is closed to new replies.