Make WordPress Core

Opened 2 years ago

Closed 8 weeks ago

#25359 closed enhancement (maybelater)

Add a filter in add_menu_page()

Reported by: juliobox Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Menus Keywords: needs-patch
Focuses: Cc:



Can we (i) was for a new hook here ?

In add_menu_page() :

$new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url );

replaced by

$new_menu = apply_filters( 'add_menu_page_args', array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon url ) );
$position = apply_filters( 'add_menu_page_position', $position );

The goal is to filter the capability, the icon etc and then the 2nd hook for the menu position.

Thank you

Change History (4)

#1 @nacin
2 years ago

I don't know if we should have a hook this deep in the API. It might prevent major overhauls like #12718. What's the more specific use case?

#2 @juliobox
2 years ago

Hello Andrew
thank you for your time.
#12718 is a good thing, my goal was to avoid plugins addings their own menus between WP menus. I prefer - for my clients - to put the additional menus at the bottom of the menu's structure.
Also i wanted to set an icon if none was specified (maybe CSS can already help me, i admit).
but maybe i have to wait for the new menu structure, then think about this hooks.
ps : http://i.imgur.com/NoPzGVo.jpg

#3 @SergeyBiryukov
2 years ago

  • Type changed from feature request to enhancement
  • Version changed from trunk to 3.6

#4 @chriscct7
8 weeks ago

  • Keywords needs-patch added
  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Severity changed from trivial to normal
  • Status changed from new to closed

Closing as maybelater. Complete lack of interest on the feature on the ticket over the last 2 years. Feel free to reopen when more interest re-emerges (particularly if there's a patch)

Note: See TracTickets for help on using tickets.