WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 5 months ago

#19206 closed defect (bug) (duplicate)

Improve internal admin menu code

Reported by: 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 4 years ago.
19206.php (5.2 KB) - added by koopersmith 4 years ago.

Download all attachments as: .zip

Change History (8)

@koopersmith4 years ago

@koopersmith4 years ago

comment:1 @koopersmith4 years ago

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

comment:2 @DrewAPicture4 years ago

  • Cc xoodrew@… added

comment:3 follow-up: @toscho4 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?

comment:4 in reply to: ↑ 3 @nacin4 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.

comment:5 @chriscct78 months 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)

comment:6 @helen5 months 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.