Wordpress: remove menu Administration
Saturday, November 1, 2008 It may be useful at times to shadow some of the administration menu of WordPress, especially if you developed a website / blog for a client and do not want to allow access to particularly sensitive features. There are already plugins that provide this function, but for a personal check and complete, we see how it works in detail this feature.
As always, we use the very useful Action provided by Wordpress, in this case admin_menu Using the global variable $menu we can access the contextual menu of the administration. We can find the menu to "eliminate" in two ways: through the label or through the link pointed to (Part commented example below). In the example are shadowed menu items Design, Settings, and Plugins:
- remove_menu_item function () (
- ; global $ menu;
- / / By label
- / / Through links
- / / $ Removes = array ( 'themes.php', 'options-general.php', 'plugins.php');
- $removes as $todel ) foreach ($ removes as $ todel)
- / / Through links
- / / Foreach ($ menu as $ key => $ sm) if ($ sm [2] == $ todel) (unset ($ menu [$ key]) break;)
- )
- / /
- , 'remove_menu_item' ) ; add_action ( 'admin_menu', 'remove_menu_item');
Use the link as a key for removal $sm[2] in parts surprise and comment in the code here), is useful when you are not sure of the language - localization - with which you installed Wordpress. With this technique, however, the menu is removed only at the interface, so you can still access the site via a direct link.













Very nice tutorial.
We often ask on the support forum how to remove the menu 'on board but at the user level.
If I could add to the control of the user level and if we allow him publish this code in the wiki.
hello
@ Wolf: Indeed, I hope it is useful ... See Very short snippet: Wordpress administrator?
But give him an account, less powerful, no?
@ Camu is not a question of power of the account, there are some who would like to see who writes on their blog to write only that part and can not see anything else even the comments.
And 'their needs, right or wrong, and given that they ask many prefer to give them a solution.
hello
[...] The new version of WordPress 2.7 has a page of the genre. The problem will then inhibit the rest but you can try these scripts udolog http://www.undolog.com/2008/11/01/wordpress-rimuovere-i-menu-dellamministrazione/ [...]
good, then if you connect to the Admin tiger furi plugin is also a nice graphics package for customers.
Sorry but I can not get away with the code ...
I described this need to limit the intervention on the blog. Being a club everyone wants its share of access but of course I have to include assistance to the blog.
I thought a plugin but I can not find it appropriate and with the code I realized that it acts at the admin menu ... Recommendations please?
Sorry, but where to put that code??
Thank you in advance
@ Peter:
Can put in the file
functions.phpwhich is in the folder of your active theme. Alternatively, if you're developing your own plugin, the code of the latter. In practice, the important thing is that this code is executed at least once ...Thanks, you're putting it into a function, even if existing plugins?
No, because I am creating a web hosting service where people can request a perosna del propio blog based on WordPress platform (NOT mu) I would hide from the menu button that sends the administrative management of plugins EasyAdsense so that the 'user can not amend the advertisement to his liking.
Do you know if you can? Or in which file to put that code protein without being erased when you upgrade Wordpress, plugins or templates?
Thanks again, I await answers
@ Peter:
Sure, you can enter it - of course - even in a plugin already exists.
@ Peter:
This procedure is used so as to hide some controls to any users who work in the backend of WordPress. For updates, however, you must find a "place" that surely can not be overwritten by updates. WordPress MU, for example, we simplify the task as it has the ability to "impose" the plugin at all sub-blogs.
On normal WordPress installation, where you can update your version, update the theme (and then overwrite the file index.php) and update the plugin (and then delete or disable them) do not know where to place the code ... think and let you know.
Enter a file. Htaccess file in the root will?