Skip to content

add support for more params of wp_dropdown_categories() and wp_list_categories() #68324

@pbiron

Description

@pbiron

What problem does this address?

I've got a Categories block (with "Display as dropdown" is enabled) in the "Categories" template in a block theme I'm developing.

I have an immediate need to have the "current category" be selected when the block renders (i.e., to set the selected param passed to wp_dropdown_categories().

Additionally, I'd like to have an "All" option added to the SELECT element (i.e., to set the show_option_all param passed to wp_dropdown_categories()) which, when selected by the end-user, will send them to the "Blog Home" template.

I can imagine that others would also want a way to set other params to wp_dropdown_categories() and/or wp_list_categories(). I originally was going to use "support ALL params" in the title of this issue, but of course, I don't think there are valid use cases for being able to set params like echo, etc. Hence, the title of "support for more params...".

Related issue: #30767

What is your proposed solution?

I understand that designing a simple UI/UX for some of those params could be difficult. As a first step, it would be fine by me to add appropriate attributes for the blog and require going to the "Code Editor" to be able to set them (there is precedence for this in other blocks).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions