{"id":2824,"date":"2014-07-31T21:16:31","date_gmt":"2014-07-31T21:16:31","guid":{"rendered":"http:\/\/www.deuzebranaweb.com.br\/?p=2824"},"modified":"2014-07-31T21:16:31","modified_gmt":"2014-07-31T21:16:31","slug":"how-to-remove-entire-admin-menu","status":"publish","type":"post","link":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/2014\/07\/31\/how-to-remove-entire-admin-menu\/","title":{"rendered":"How to remove entire admin menu?"},"content":{"rendered":"<p>The correct hook to use is admin_menu and then create a function to remove the menus you want to remove. The following 2 functions remove all the menus.<\/p>\n<p>add_action( &#8216;admin_menu&#8217;, &#8216;remove_admin_menus&#8217; );<br \/>\nadd_action( &#8216;admin_menu&#8217;, &#8216;remove_admin_submenus&#8217; );<\/p>\n<p>\/\/Remove top level admin menus<br \/>\nfunction remove_admin_menus() {<br \/>\n    remove_menu_page( &#8216;edit-comments.php&#8217; );<br \/>\n    remove_menu_page( &#8216;link-manager.php&#8217; );<br \/>\n    remove_menu_page( &#8216;tools.php&#8217; );<br \/>\n    remove_menu_page( &#8216;plugins.php&#8217; );<br \/>\n    remove_menu_page( &#8216;users.php&#8217; );<br \/>\n    remove_menu_page( &#8216;options-general.php&#8217; );<br \/>\n    remove_menu_page( &#8216;upload.php&#8217; );<br \/>\n    remove_menu_page( &#8216;edit.php&#8217; );<br \/>\n    remove_menu_page( &#8216;edit.php?post_type=page&#8217; );<br \/>\n    remove_menu_page( &#8216;themes.php&#8217; );<br \/>\n}<\/p>\n<p>\/\/Remove sub level admin menus<br \/>\nfunction remove_admin_submenus() {<br \/>\n    remove_submenu_page( &#8216;themes.php&#8217;, &#8216;theme-editor.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;themes.php&#8217;, &#8216;themes.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;edit.php&#8217;, &#8216;edit-tags.php?taxonomy=post_tag&#8217; );<br \/>\n    remove_submenu_page( &#8216;edit.php&#8217;, &#8216;edit-tags.php?taxonomy=category&#8217; );<br \/>\n    remove_submenu_page( &#8216;edit.php&#8217;, &#8216;post-new.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;themes.php&#8217;, &#8216;nav-menus.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;themes.php&#8217;, &#8216;widgets.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;themes.php&#8217;, &#8216;theme-editor.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;plugins.php&#8217;, &#8216;plugin-editor.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;plugins.php&#8217;, &#8216;plugin-install.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;users.php&#8217;, &#8216;users.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;users.php&#8217;, &#8216;user-new.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;upload.php&#8217;, &#8216;media-new.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;options-general.php&#8217;, &#8216;options-writing.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;options-general.php&#8217;, &#8216;options-discussion.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;options-general.php&#8217;, &#8216;options-reading.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;options-general.php&#8217;, &#8216;options-discussion.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;options-general.php&#8217;, &#8216;options-media.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;options-general.php&#8217;, &#8216;options-privacy.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;options-general.php&#8217;, &#8216;options-permalinks.php&#8217; );<br \/>\n    remove_submenu_page( &#8216;index.php&#8217;, &#8216;update-core.php&#8217; );<br \/>\n}<br \/>\nScreenshot of left menu using the above 2 functions:<\/p>\n<p>enter image description here<\/p>\n<p>shareimprove this answer<br \/>\nedited Sep 27 &#8217;13 at 6:02<\/p>\n<p>answered May 15 &#8217;12 at 3:09<\/p>\n<p>Chris_O<br \/>\n13.9k22360<br \/>\n1<br \/>\nI did find another way by using $GLOBALS[&#8216;menu&#8217;] = array();. Giving null in the array will also do the work. \u2013  dev-jim May 15 &#8217;12 at 11:13 <\/p>\n<p>Where do you put this? \u2013  user26728 Jul 17 &#8217;13 at 14:22<\/p>\n<p>Anyone noticed the recent drafts from that screen shot? \ud83d\ude09 \u2013  acSlater Sep 24 &#8217;13 at 15:02<br \/>\nadd a comment<\/p>\n<p>up vote<br \/>\n2<br \/>\ndown vote<br \/>\nFollowing the lead of \/wp-admin\/admin-header.php -> \/wp-admin\/menu-header.php there&#8217;s no hook to do it.<\/p>\n<p>A solution is to hook in admin_head and do some CSS + jQuery<\/p>\n<p>add_action(&#8216;admin_head&#8217;, &#8216;wpse_52099_script_enqueuer&#8217;);<br \/>\nfunction wpse_52099_script_enqueuer(){<br \/>\n    if(!current_user_can(&#8216;administrator&#8217;)) {<br \/>\n        echo < <<HTML\n        \n\n<style type=\"text\/css\">\n        #wpcontent, #footer { margin-left: 0px; }<\/p>\n<p>        <script type=\"text\/javascript\">\n        jQuery(document).ready( function($) {\n            $('#adminmenuback, #adminmenuwrap').remove();\n        });     \n        <\/script><br \/>\nHTML;<br \/>\n    }<br \/>\n}<\/p>\n<p>http:\/\/wordpress.stackexchange.com\/questions\/52099\/how-to-remove-entire-admin-menu<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The correct hook to use is admin_menu and then create a function to remove the menus you want to remove. The following 2 functions remove all the menus. add_action( &#8216;admin_menu&#8217;, &#8216;remove_admin_menus&#8217; ); add_action( &#8216;admin_menu&#8217;, &#8216;remove_admin_submenus&#8217; ); \/\/Remove top level admin menus function remove_admin_menus() { remove_menu_page(&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_angie_page":false,"page_builder":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-2824","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=2824"}],"version-history":[{"count":0,"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2824\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=2824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=2824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.deuzebranaweb.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=2824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}