Make WordPress Core

Opened 19 months ago

Last modified 16 months ago

#25359 new enhancement

Add a filter in add_menu_page()

Reported by: juliobox Owned by:
Milestone: Awaiting Review Priority: normal
Severity: trivial Version: 3.6
Component: Menus Keywords:
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 (3)

comment:1 @nacin18 months 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?

comment:2 @juliobox18 months 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

comment:3 @SergeyBiryukov16 months ago

  • Type changed from feature request to enhancement
  • Version changed from trunk to 3.6
Note: See TracTickets for help on using tickets.