Make WordPress Core

Opened 12 years ago

Closed 9 years ago

#19206 closed defect (bug) (duplicate)

Improve internal admin menu code

Reported by: koopersmith's profile koopersmith Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Administration Keywords: needs-refresh
Focuses: Cc:

Description

The internal admin menu code is both hard to read and filled with several unnecessary branches. This makes maintaining the code quite difficult.

A few uses of list and smarter branching can considerably improve _wp_menu_output. Patch attached. Let's revisit this when we branch for 3.4.

Attachments (2)

19206.diff (9.9 KB) - added by koopersmith 12 years ago.
19206.php (5.2 KB) - added by koopersmith 12 years ago.

Download all attachments as: .zip

Change History (8)

@koopersmith
12 years ago

@koopersmith
12 years ago

#1 @koopersmith
12 years ago

I've attached both a diff and a copy of the function to make updating the diff less difficult.

#2 @DrewAPicture
12 years ago

  • Cc xoodrew@… added

#3 follow-up: @toscho
12 years ago

  • Cc info@… added

I would really love to see the native nav menu code reused. It should be possible to use a custom walker to create the admin menu (and the admin bar). This would reduce the learning curve and the code base. Maybe in 3.4?

#4 in reply to: ↑ 3 @nacin
12 years ago

Replying to toscho:

I would really love to see the native nav menu code reused. It should be possible to use a custom walker to create the admin menu (and the admin bar). This would reduce the learning curve and the code base. Maybe in 3.4?

That's been proposed before but it feels incredibly hacky. I wouldn't mind implementing this as a walker, though. The current admin menu code -- menu.php x 4, menu-header.php, etc. -- is definitely the worst code in WordPress at the moment.

#5 @chriscct7
9 years ago

  • Keywords needs-refresh added; 3.4-early has-patch removed

Needs a refresh (functions been changed in numerous places over the past 3 years)

#6 @helen
9 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I think we can call this a duplicate of the long-suffering #12718.

Note: See TracTickets for help on using tickets.