Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    The short answer is “you can’t”. To avoid various compatibility issues, this plugin only modifies $menu and $submenu right before WordPress outputs the admin menu, and then it restores the original values afterwards.

    If you want to make some changes to a menu item, this plugin does have two filters that you could use: custom_admin_menu and custom_admin_submenu. Each of the filters is called multiple times: once per menu item of the appropriate type. custom_admin_menu is used for top level menus and custom_admin_submenu is for submenu items.

    The filter argument is an array of menu properties in an internal, plugin-specific format.

    Thread Starter mehediasadpur

    (@mehediasadpur)

    Can you please provide example code with these filter or link to official documentation. i don’t find this filter in google search.

    Plugin Author Janis Elsts

    (@whiteshadow)

    These are custom filter created by the plugin. There is no official documentation.

    Here’s a basic example that adds an exclamation mark to top level menu titles:

    add_filter('custom_admin_menu', function($item) {
    	$item['menu_title'] = $item['menu_title'] . '!'; 
    	return $item;
    });
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom menu not found in $menu or $submenu’ is closed to new replies.