Home  • Framework • Wordpress

add_menu_page() function prototype in wordpress

we-use-addmenupage-to We use

add_menu_page()

to create a top-level menu entry. This function takes a number of arguments: 1 Page title – used in the title tag of the page (shown in the browser bar) when it is displayed. 2 Menu title – used in the menu on the left. 3 Capability – the user level allowed to access the page. 4 Menu slug – the slug used for the page in the URL. 5 Function – the name of the function you will be using to output the content of the page. 6 Icon – A url to an image or a Dashicons string. 7 Position – The position of your item within the whole menu.

Example

function my_plugin_menu() {
	add_menu_page('My Plugin Settings', 'Plugin Settings', 'administrator', 'my-plugin-settings', 'my_plugin_settings_page', 'dashicons-admin-generic');
}

add_action('admin_menu', 'my_plugin_menu');

Comments 0


Share

Copyright © 2024. Powered by Intellect Software Ltd