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

WordPress Trac noreply at wordpress.org
Sat Sep 23 09:24:43 UTC 2017


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

Comment (by finalplayerryu):

 Replying to [comment:1 milana_cap]:
 > Hi @finalplayerryu
 >
 > Are you sure you're trying to select category that is already selectable
 option? E.G. trying to select empty category without specifying
 `'hide_empty' => 0`.
 >
 > I can't reproduce the issue. It works fine with both for me.

 Following call i used:
 wp_dropdown_categories( array("name" => "category", "id" => "uncategory",
 "hide_empty" => 0, "echo" => 0, "show_option_none" => " ", "selected" =>
 258 ) );

 it didn't work unless i put the quotation marks around 258.

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


More information about the wp-trac mailing list