Add Custom Admin Menu Item

Adds a custom menu item to the WordPress admin menu

PHP

function add_custom_menu_item() {
    add_menu_page('Custom Page', 'Custom Menu', 'manage_options', 'custom-page', 'custom_page_content', 'dashicons-admin-generic', 6);
}
add_action('admin_menu', 'add_custom_menu_item');

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

Snippet Feedback

Did this snippet work for you? Do you have any questions about this snippet? Leave some feedback below.
SHARED BY

2 Views

Tags

Language

Did it work?

Save Snippet

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.

Embed Snippet

To embed this snippet on your site, copy this html code and paste into your webpage. Learn more
By embedding snippets on your site, you are agreeing to our terms and conditions.