create custom admin menu in wordpress code example

Example: add admin menu link custom wp

add_action( 'admin_menu', 'register_custom_menu_link' );
/**
 * @author    Brad Dalton
 * @example   http://wpsites.net/wordpress-admin/add-top-level-custom-admin-menu-link-in-dashboard-to-any-url/
 * @copyright 2014 WP Sites
 */
function register_custom_menu_link(){
    add_menu_page( 
      'custom menu link', 
      'Your Menu Link', 
      'manage_options', 
      'any-url', 
      'wpsites_custom_menu_link', 
      'dashicons-external', 3
    ); 
}

function wpsites_custom_menu_link(){
    wp_redirect( 'http://www.example.com', 301 ); 
	exit;
}

Tags:

Php Example