Created
February 16, 2011 18:30
-
-
Save staydecent/829869 to your computer and use it in GitHub Desktop.
Function to Remove a top level admin menu (taken from WP trac)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Function taken from http://core.trac.wordpress.org/changeset/15753 | |
Awaiting release of WP 3.1.0 | |
Credits: scribu | |
*/ | |
if ( ! function_exists('remove_menu_page') ) { | |
/** | |
* Remove a top level admin menu | |
* | |
* @since 3.1.0 | |
* | |
* @param string $menu_slug The slug of the menu | |
* @return array|bool The removed menu on success, False if not found | |
*/ | |
function remove_menu_page( $menu_slug ) { | |
global $menu; | |
foreach ( $menu as $i => $item ) { | |
if ( $menu_slug == $item[2] ) { | |
unset( $menu[$i] ); | |
return $item; | |
} | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment