I’m lost, I don’t understand why this works
http://website.com/?tag=my-cat-slug
and not this
http://website.com/?tag=15
It’s really annoying because wp_dropdown_categories()
only provides ids as values.
I tried to change permalinks to default settings instead of rewriting:
http://website.com/?p=123
But it changed nothing
Because the
tag
query variable expects the value to the terms slug. It’ll be looking for the term with slug ’15’ (which presumably doesn’t exist).And, yes its quite frustrating that
wp_dropdown_categories()
uses the ID as the value, rather than the slug. This is because it was originally used only for categories (for which IDs rather than slugs are generally used) as opposed to general taxonomies.However, there is this ticket on it. I have created this gist, which can allow you to make
wp_dropdown_categories()
use slugs rather than IDs for the value.For reference (the following class should go in a plug-in):
Usage
The ‘value’ parameter optional. The default value will be ‘id’ for categories, and ‘slug’ for other taxonomies.