WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#34187 closed enhancement (invalid)

merge wp_list_categories with wp_dropdown_categories

Reported by: nguyenvanduocit Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description

I think function wp_list_categories and wp_dropdown_categories is the same. We can merge them into one function

Change History (2)

#1 @boonebgorges
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi nguyenvanduocit - Thanks for the ticket!

The two functions support many of the same parameters. But many of the default values are different. So you'd have to do some argument overriding when 'format=dropdown' that wouldn't happen when 'format=list'. The two functions use different walkers - another thing that'd have to be handled via parameter. And then they handle markup differently, since they generate very different kinds of markup, so a combined function would have lots of if ( 'list' === $format ) types of blocks.

If there are specific problems that would be solved by merging the two functions, please feel free to outline them. If this is just about reducing duplication, I don't think much duplication will, in fact, be avoided by merging. Let's not refactor for the sake of refactoring.

#2 @SergeyBiryukov
4 years ago

  • Component changed from General to Taxonomy
Note: See TracTickets for help on using tickets.