How to hide items from the administration menu

WordPress is known for its simplicity and user-friendly administration, however when you build e project for a client, with no previous experience with the WordPress CMS , you always instruct him to avoid going in the Permalinks area or frequently changing the site`s title or tagline. A better solution to that problem would be to just hide the menu items, which you think can be harmful if misused. In my example the plugin will hide the entire “Settings” menu.


<?php
/*
Plugin Name: Hide settings
Plugin URI: http://awordpress.net
Description: Hiding the settings menu.
Version: 1.0
Author: Pavel Petrov
Author URI: http://awordpress.net
License: GPL2
*/
add_action( 'admin_menu', 'awp_hide_settings' );
function awp_hide_settings() {
    remove_menu_page( 'options-general.php' );
}

?>

The usage is no-different then a regular plugin. You upload the php file in your plugins folder and activate the Plugin.

If you want to hide a sub-menu item from the menu(ie Permalinks in Settings) you can use the following alternative:


<?php
/*
Plugin Name: Hide settings
Plugin URI: http://awordpress.net
Description: Hiding the settings menu.
Version: 1.0
Author: Pavel Petrov
Author URI: http://awordpress.net
License: GPL2
*/
add_action( 'admin_menu', 'awp_hide_settings' );
function awp_hide_settings() {
    remove_submenu_page( 'options-general.php', 'options-permalink.php' );
}

?>

Download the “Hide settings” plugin from this tutorial here.