Worpress Submenu Page External Link

Okay so I’ve officially hit the “this is why other developers start a blog” point.

I’m tired of digging through bookmarks and code snippers to see how I’ve done something in the past and for most stuff GitHub is just not an option for simple snippets.

I wanted to add a submenu item to a Custom Post Type that pointed somewhere else.

Here’s how to do it:

add_action( 'admin_menu' , 'dlb_challenge_redirects' );

function dlb_challenge_redirects() {
 global $submenu;
 $submenu["edit.php?post_type=dlb-challenge"][] = array('Manage Actions', 'manage_categories' , "[URL GOES HERE]" );

*Caveat – The menu you’re adding this sub menu page to must already exist.