When deploying WordPress sites for clients, it can be extremely useful to customize aspects of the WordPress admin area. For users who are not familiar with WordPress, some aspects of the admin area can be confusing, especially if they are not being directly utilized by the client. For example, not all users need a Links section for their site (perhaps less is more if you are designing a site for a client using WordPress). So here’s a quick tip for removing menu items from the main admin navigation.
Simply paste this into your functions.php:
// function to remove the Links menu item function remove_menus() { // setup the global menu variable global $menu; // this is an array of the menu item names we wish to remove $restricted = array( __('Links'),__('Tools'),__('Settings'),__('Comments')); end ($menu); while (prev($menu)) { $value = explode(' ',$menu[key($menu)][0]); if(in_array($value[0] != NULL?$value[0]:"" , $restricted)) { unset($menu[key($menu)]); } } } // hook into the action that creates the menu add_action('admin_menu', 'remove_menus');
This code will remove the Links, Tools, Settings, and Comments menu items. Simply add all the menu names you wish to remove to this part of the code above:
$restricted = array( __('Links'),__('Tools'),__('Settings'),__('Comments'));
So what would it look like if you wanted to remove the Tools, Comments, Appearance, Plugins, and Settings menus? The complete code is this:
// function to remove the Links menu item function remove_menus() { // setup the global menu variable global $menu; // this is an array of the menu item names we wish to remove $restricted = array( __('Tools'),__('Comments'),__('Appearance'),__('Plugins'),__('Settings')); end ($menu); while (prev($menu)) { $value = explode(' ',$menu[key($menu)][0]); if(in_array($value[0] != NULL?$value[0]:"" , $restricted)) { unset($menu[key($menu)]); } } } // hook into the action that creates the menu add_action('admin_menu', 'remove_menus');
I hope you found this article useful. If you are unsure about anything please let me know
Pippin






WordPress is a fantastic blogging tool and publishing platform, but is it optimised out of the box for Search Engine Optimisation (SEO)? Well, despite the fact that the search engines tend to love websites built on the WordPress platform, it isn't particularly well optimised with a default installation. In the default WordPress installation, it does not include meta tags such as meta description and meta keywords. If you want to supply search engines with specific information, relevant to your websites pages, you are going to have to add the meta tag data yourself.
- spam
- offensive
- disagree
- off topic
Like