Skip to main content
All CollectionsMainWP Customization
How to add new menu entries to the MainWP Dashboard navigation
How to add new menu entries to the MainWP Dashboard navigation
Updated over 2 weeks ago

In version 4.5 of the MainWP Dashboard, we’ve introduced a new, modern navigation system.

It is possible to add new menu entries using a filter, and in the example below, we are adding a new entry, “Updates” at the index position 2.

To add an entry of your choice, modify the values of $addition_item[] as needed, as well as $index to change the position of the new menu entry.

NOTE: The code snippet is commented so please refer to it for more information about each line of the code.

The easiest way to apply the code snippet is using our Custom Dashboard extension and placing it in the PHP tab.

add_filter( 'mainwp_main_menu', 'mycustom_mainwp_main_menu', 10, 1 ); function mycustom_mainwp_main_menu( $left_menu ) { $index = 2; // Position of the menu item being added. $sub_menu_after = array_splice( $left_menu['leftbar'], $index ); $addition_item = array(); $addition_item[] = 'Updates'; // This is the title of the menu item being added. $addition_item[] = 'mainwp_tab'; // Parent key. $addition_item[] = 'admin.php?page=UpdatesManage'; // This is the URL of the menu item being added. $addition_item[] = 'updates_custom_id'; // The ID attribute. $addition_item[] = ''; // This is the icon of the menu item being added. You can find all available icons here: https://fomantic-ui.com/elements/icon.html. $left_menu['leftbar'][] = $addition_item; // Add the additional item to the leftbar array. $left_menu['leftbar'] = array_merge( $left_menu['leftbar'], $sub_menu_after ); // Merge leftbar and $sub_menu_after arrays. return $left_menu; // Returns updated $left_menu array. }

After saving the snippet, the new menu entry will be added to the First Level Nav.

Did this answer your question?