Add Custom Admin Menu Item

Add a new top-level menu item to the WordPress admin dashboard.

<?php
function add_custom_admin_menu() {
    add_menu_page(
        'Custom Page Title', // Page title
        'Custom Menu', // Menu title
        'manage_options', // Capability
        'custom-menu-slug', // Menu slug
        'custom_menu_page_content', // Function to display content
        'dashicons-admin-generic', // Icon URL
        6 // Position
    );
}
add_action('admin_menu', 'add_custom_admin_menu');

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

Post Comment