The add_menu_page(1,2,3,4,5,6,7) and its seven arguments

The add_menu_page function in WordPress is used to add a new top-level menu item in the admin dashboard. Here’s a breakdown of the parameters:

  1. Page Title: The text displayed in the browser title when the menu page is active.
  2. Menu Title: The text displayed on the menu item in the admin sidebar.
  3. Capability: The required capability to access this menu item (e.g., manage_options).
  4. Menu Slug: A unique identifier for the menu item, used in the URL.
  5. Function: The function that displays the content of the page.
  6. Icon URL: URL to the icon displayed in the menu (optional).
  7. Position: The position in the menu order where this item should appear (optional).


    'My Page Title', // Page title
    'My Menu',       // Menu title
    'manage_options',// Capability
    'my_menu_slug',  // Menu slug
    'my_callback_function', // Function to display content
    '',              // Icon URL (optional)
    6                // Position (optional)

This creates a new menu item in the WordPress admin with the specified properties.

Leave a Reply

Your email address will not be published. Required fields are marked *