Add Custom Admin Submenu Item

Add a submenu item under an existing admin menu.

<?php
function add_custom_admin_submenu() {
    add_submenu_page(
        'tools.php', // Parent slug
        'Submenu Page Title', // Page title
        'Submenu Title', // Menu title
        'manage_options', // Capability
        'custom-submenu-slug', // Menu slug
        'custom_submenu_page_content' // Function to display content
    );
}
add_action('admin_menu', 'add_custom_admin_submenu');

function custom_submenu_page_content() {
    echo '<h1>Welcome to the Custom Submenu Page</h1>';
}
?>

Post Comment