In WordPress adding to an Existing Menu of Plugin by Web Design London

In this article you will learn how to add a submenu item to an existing menu in WordPress. In WordPress mostly plugins have only one option page so they don’t require an entirely separate the top-level menu. For accomplish this, in WordPress add a plugin option page to any existing menu. You can add a submenu to the Setting menu:

<?php

add_action( ‘admin_menu’, ‘csm_create_settings_submenu’ );

function csm_create_settings_submenu() {

add_options_page( ‘Web Design Settings Page’, ‘Web Design Settings’, ‘manage_options’, ‘webdesign_settings_menu’, ‘csm_settings_page’ );

}

?>

To add the submenu it is extremely easy in WordPress and it has features multiple functions to make adding submenus. The add_options_page() function use to add your Web Design Settings submenu. The function parameters you can see, the first parameter is the page title it will be the submenu display name. As your other menus, set the capability by manage_options, by the manage option set this menu will viewable only by administrators.After that, set the unique menu handle to webdesign_settings_menu. At the end, you call your custom cwm_settings_page() function to build your options page. The above example will adds your custom submenu items Web Design Settings at the bottom of the settings menu.

Below is a list of the available submenu functions in WordPress. Below we are discussed every function responsibility and each function can be used exactly as the preceding example; simply replace the function name called with one of the functions listed here:

  • add_dashboard_page() — It is use for adds submenu items to the Dashboard menu.
  • add_posts_page() — It is use for adds submenu items to the Posts menu
  • add_media_page() — It is use for adds a submenu item to the Media menu
  • add_links_page() — It is use for adds a submenu item to the Links menu
  • add_pages_page() — It is use for adds a submenu item to the Pages menu
  • add_comments_page() — It is use for adds a submenu item to the Comments menu
  •  add_plugins_page() — It is use for adds a submenu item to the Plugins menu
  • add_theme_page() — It is use for adds a submenu item to the Appearance menu
  • add_users_page() — It is use for adds a submenu item to the Users page, or Profile based on role
  • add_management_page() —  It is use for adds a submenu item to the Tools menu
  • add_options_page() — It is use for adds a submenu item to the Settings menu

After using these functions you can make your submenus and enjoy the wordpress functionalities.