Created
October 25, 2019 09:29
-
-
Save tozbey/b1aa2cf11a699b72ad390cb5aa749e81 to your computer and use it in GitHub Desktop.
Hide admin menu items and subitems
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
/** | |
* Hide admin menu items. Can be both parents and children in dropdowns. | |
* Specify link to parent and link to child. | |
* @link https://codex.wordpress.org/Function_Reference/remove_menu_page | |
*/ | |
add_action( 'admin_menu', function () { | |
// Remove Settings | |
remove_menu_page( 'options-general.php' ); | |
// Remove Settings -> Writing | |
remove_submenu_page( 'options-general.php', 'options-writing.php' ); | |
// Remove Settings -> Reading | |
remove_submenu_page( 'options-general.php', 'options-reading.php' ); | |
// Remove Settings -> Discussion | |
remove_submenu_page( 'options-general.php', 'options-discussion.php' ); | |
// Remove Settings -> Media | |
remove_submenu_page( 'options-general.php', 'options-media.php' ); | |
// Remove Settings -> Permalinks | |
remove_submenu_page( 'options-general.php', 'options-permalink.php' ); | |
// Remove Plugins | |
remove_menu_page( 'plugins.php' ); | |
// Remove Yoast | |
remove_menu_page( 'wpseo_dashboard' ); | |
}, 999); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment