[wp-trac] [WordPress Trac] #41960: wp_dropdown_categories: "selected" only works with string, not integer

WordPress Trac noreply at wordpress.org
Mon Sep 25 04:16:12 UTC 2017


#41960: wp_dropdown_categories: "selected" only works with string, not integer
----------------------------+-------------------------
 Reporter:  finalplayerryu  |       Owner:
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:
Component:  General         |     Version:  4.8.2
 Severity:  normal          |  Resolution:  worksforme
 Keywords:                  |     Focuses:  docs
----------------------------+-------------------------
Changes (by peterwilsoncc):

 * status:  new => closed
 * resolution:   => worksforme
 * milestone:  Awaiting Review =>


Comment:

 @finalplayerryu,

 I tested this with the arguments provided above and can not reproduce
 either:

 {{{#!php
 <?php
 $args = array(
         'name'             => 'category',
         'id'               => 'uncategory',
         'hide_empty'       => 0,
         'echo'             => 0,
         'show_option_none' => ' ',
         'selected'         => (int) $cat_id,
 );

 $actual = wp_dropdown_categories( $args );
 }}}

 I'm going to close this ticket as worksforme because a couple of people
 have been unable to reproduce it. It might be worth checking if a theme or
 plugin is interfering with your code.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41960#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list