[wp-trac] [WordPress Trac] #16734: Allowing multiple selection when using wp_dropdown_* functions (was: Allowing multiple selection when using wp_dropdown_categories)

WordPress Trac noreply at wordpress.org
Tue May 27 02:40:46 UTC 2014


#16734: Allowing multiple selection when using wp_dropdown_* functions
---------------------------+------------------
 Reporter:  grandslambert  |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  4.0
Component:  Taxonomy       |     Version:  3.1
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+------------------
Changes (by wonderboymusic):

 * keywords:  has-patch dev-feedback => has-patch
 * milestone:  Awaiting Review => 4.0


Old description:

> I would like to be able to pass an argument to wp_dropdown_categories()
> to allow the user to select more than one category using a CTRL-CLICK. I
> can use a preg_replace to add the multiple tag to the html select tag,
> but I cannot pass multiple selections in the "selected" argument.
>
> I modified two files (wp-includes/category-template.php and wp-admin/css
> /wp-admin.css) to add this option and will include patches for these
> files. It adds a boolean argument for "multiple" to
> wp_dropdown_categories and uses in_array to check if terms are listed in
> an array in the "selected" argument, casting it as an array if it is not.
> I have tested this patch to work in the latest trunk (3.1).
>
> The change in the w-admin.css is so the multiple selection box is tall
> enough to show the slider and more than one category.

New description:

 I would like to be able to pass an argument to wp_dropdown_categories() to
 allow the user to select more than one category using a CTRL-CLICK. I can
 use a preg_replace to add the multiple tag to the html select tag, but I
 cannot pass multiple selections in the "selected" argument.

--

Comment:

 [attachment:16734.diff 16734.diff] adds `'multiple' => false` to the
 default args for `wp_dropdown_(categories|pages|users)()`.

 No instances in core use this, but it will allow users to have multiple-
 select for whatever their little hearts desire.

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


More information about the wp-trac mailing list