Customizing the main navigation menu

In WordPress, the main navigation menu is located on the left of the screen where we have access to all the sections of the application. Similar to the admin toolbar, we have the ability to extend the main navigation menu with customized versions. Let's start by adding the admin-menu-invoking action to the constructor:

add_action( 'admin_menu', array( $this,'wpwa_customize_main_navigation' ) );

Now, consider the initial implementation of the wpwa_customize_main_navigation function:

public function wpwa_customize_main_navigation(){
  global $menu,$submenu;
  echo "<pre>";print_r($menu);exit;
}

The preceding code uses the global variable menu for accessing the available main navigation menu items. Before we begin the ...

Get WordPress Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.