Opened 6 years ago
Closed 3 years ago
#4701 closed enhancement (worksforme)
ID attribute for adminmenu items
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Administration | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Administration menu customizations are very limited right now (think: icons for menu items), partially due to the fact that menu items don't have ID attributes. The attached patch (against trunk r5844) generates ID attributes using sanitize_title(). The resulting values look like "adminmenu_dashboard" and "submenu_write-post".
There was a preliminary OK for this functionality from Matt on wp-hackers list:
http://comox.textdrive.com/pipermail/wp-hackers/2007-July/013746.html
Attachments (1)
Change History (12)
item[0] is a translated string. It will change depending on the locale. I think we have to sanitize the filename or add a unique, consistent identifier to the menu arrays.
I wish that part of menu-header.php was written somehow simpler. I have to drink five pints before I can make any sense of it, and I do forget it all by the next morning. :)
On the serious note, would calling sanitize_file_name($item[2]) be sufficient or is there something else to be careful about? I can redo the patch, no problem. But I really have issues understanding some of that code (a bunch of if-then-else statements with re-indexing of a heavy array).
comment:5
foolswisdom — 6 years ago
- Milestone changed from 2.3 to 2.4 (next)
- Keywords needs-patch added; has-patch removed
This will need refreshing. I'm sure I saw a newer version of this ticket with respect to the 2.7 menu area, but now I can't find it. Otherwise I'd close this off as a dupe.
- Milestone changed from 2.9 to Future Release
comment:9
johnbillion — 3 years ago
- Keywords needs-patch removed
- Milestone Future Release deleted
- Resolution set to fixed
- Status changed from new to closed
Invalid now. Every menu item has an ID and a bunch of classes.
comment:10
nacin — 3 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
comment:11
nacin — 3 years ago
- Resolution set to worksforme
- Status changed from reopened to closed

Patch wp-admin/menu-header.php to have ID attributes for admin menu