Why ids in urls don't work but slugs do?

I’m lost, I don’t understand why this works


and not this


It’s really annoying because wp_dropdown_categories() only provides ids as values.

I tried to change permalinks to default settings instead of rewriting:


But it changed nothing

Solutions Collecting From Web of "Why ids in urls don't work but slugs do?"

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

 * A walker class to use that extends wp_dropdown_categories and allows it to use the term's slug as a value rather than ID.
 * See http://core.trac.wordpress.org/ticket/13258
 * Usage, as normal:
 * wp_dropdown_categories($args);
 * But specify the custom walker class, and (optionally) a 'id' or 'slug' for the 'value' parameter:
 * $args=array('walker'=> new SH_Walker_TaxonomyDropdown(), 'value'=>'slug', .... );
 * wp_dropdown_categories($args);
 * If the 'value' parameter is not set it will use term ID for categories, and the term's slug for other taxonomies in the value attribute of the term's <option>.

class SH_Walker_TaxonomyDropdown extends Walker_CategoryDropdown{

    function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ){
        $pad = str_repeat('&nbsp;', $depth * 3);
        $cat_name = apply_filters('list_cats', $category->name, $category);

        if( !isset($args['value']) ){
            $args['value'] = ( $category->taxonomy != 'category' ? 'slug' : 'id' );

        $value = ($args['value']=='slug' ? $category->slug : $category->term_id );

        $output .= "\t<option class=\"level-$depth\" value=\"".$value."\"";
        if ( $value === (string) $args['selected'] ){   
            $output .= ' selected="selected"';
        $output .= '>';
        $output .= $pad.$cat_name;
        if ( $args['show_count'] )
            $output .= '&nbsp;&nbsp;('. $category->count .')';

        $output .= "</option>\n";



    'walker'=> new SH_Walker_TaxonomyDropdown(), 

The ‘value’ parameter optional. The default value will be ‘id’ for categories, and ‘slug’ for other taxonomies.