Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Last active December 26, 2015 23:39
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 thefuxia/7232337 to your computer and use it in GitHub Desktop.
Save thefuxia/7232337 to your computer and use it in GitHub Desktop.
function network_menu_page_url()
<?php
/**
* Get the URL for a network plugin page.
*
* @param string $menu_slug
* @param string $parent_file
* @return string|bool Url or FALSE on failure
*/
function network_menu_page_url( $menu_slug = '', $parent_file = '' ) {
if ( '' === $menu_slug ) {
if ( empty ( $GLOBALS['plugin_page'] ) )
return FALSE;
$menu_slug = $GLOBALS['plugin_page'];
}
if ( '' === $parent_file ) {
if ( empty ( $GLOBALS['parent_file'] ) )
return FALSE;
$parent_file = $GLOBALS['parent_file'];
}
$url = add_query_arg(
'page',
$menu_slug,
network_admin_url( $parent_file )
);
return esc_url( $url );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment