Update wp_dropdown_categories to allow for multiple selection

Context

The wp_dropdown_categories does not allow for a Multiple Select Field.

I modified that function she time ago to allow Multiple Selection.

There is just one new argument added:

@type string $multi Whether the `<select>` element should have the HTML5 'multiple' attribute and an `[]` in the name. Accepts '' or 'multiple'. Default '' (single).

Will you be able to help with the implementation?

Already done, just need to PR and get “permission”

Voted, makes sense to add multi-select support.

Same as Update paginate_links() with 4 new arguments - #3 by james

This should be added as a new value accepted for the existing $args array that this function receives, rather than a new parameter to the wp_dropdown_categories function.

The reason is that if we add new parameters to functions, and then WP ends up also adding a different new parameter to the same function, we have a mess and no way to retain compatibility. When there is another way to achieve something like this without changing a function signature it is best to do it that way. The $args arrays are perfect for this.

As long as it’s done that way, then no problem here.

That’s what it does

Not a new function argument but a new array member to the $args

2 Likes

PR:

4 Likes

Great job @smileBeda. Since this petition has a pull request now, I’ve updated its status and will set it to close to release votes. Any discussions related to PR should be done on GitHub.

2 Likes

This topic was automatically closed after 5 days. New replies are no longer allowed.