Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Created November 3, 2011 19:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredatch/1337595 to your computer and use it in GitHub Desktop.
Save jaredatch/1337595 to your computer and use it in GitHub Desktop.
Add external link to admin menu in WordPress
<?php
/**
* Add external links to the admin menu
*/
add_action( 'admin_menu' , 'ja_new_admin_menu_items' );
function ja_new_admin_menu_items() {
global $submenu;
$url = get_bloginfo('url');
/**
* edit.php - the parent slug, in this case will go under Posts. Using index.php would place it under Dashboard, etc.
* Scheduled - the name of the menu item
* manage_options - role which will see the link
* URL - speaks for itself :)
*/
$submenu['edit.php'][501] = array( 'Scheduled', 'manage_options' , $url . '/wp-admin/edit.php?post_status=future&post_type=post' );
}
@StuartWooster
Copy link

5 years on this was by far and away the easiest explanation to get a link added to my site. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment