Mika MAtikainen
Apr 15, 2020 · 4 min read
Display a custom gravatar in WordPress
[code lang=”php”]
function register_my_custom_menu_page() {
add_menu_page( ‘custom menu title’, ‘custom menu’, ‘manage_options’, ‘myplugin/myplugin-admin.php’, ”, ‘dashicons-admin-site’, 6 );
}
add_action( ‘admin_menu’, ‘register_my_custom_menu_page’ );
[/code]
In the example above you can see the function register_my_custom_menu_page being hooked into the admin_menu action hook. This allows you to run code when the admin menu is being generated. This is most commonly used to add a custom menu link for a plugin or theme.