{"id":6664,"date":"2020-03-20T16:45:15","date_gmt":"2020-03-20T07:45:15","guid":{"rendered":"https:\/\/cooss.net\/hiding-the-wordpress-admin-menu-en\/"},"modified":"2025-04-07T14:57:39","modified_gmt":"2025-04-07T05:57:39","slug":"hiding-the-wordpress-admin-menu-en","status":"publish","type":"post","link":"https:\/\/cooss.net\/en\/hiding-the-wordpress-admin-menu-en\/","title":{"rendered":"Hide admin menu in WordPress"},"content":{"rendered":"\n<p>When using WordPress, a black bar (Admin Bar) is always displayed at the top.<\/p>\n\n\n\n<p>WordPress allows users to register, and to Hide admin menu for regular members, you need to add the following line to the function.php file located in the folder of the theme you are using.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"957\" height=\"161\" src=\"http:\/\/blog.cooss.net\/wp-content\/uploads\/2020\/03\/wp_hide_adminbar.jpg\" alt=\"Hide admin bar\" class=\"wp-image-310\" title=\"\" srcset=\"https:\/\/cooss.net\/wp-content\/uploads\/2020\/03\/wp_hide_adminbar.jpg 957w, https:\/\/cooss.net\/wp-content\/uploads\/2020\/03\/wp_hide_adminbar-300x50.jpg 300w, https:\/\/cooss.net\/wp-content\/uploads\/2020\/03\/wp_hide_adminbar-768x129.jpg 768w\" sizes=\"(max-width: 957px) 100vw, 957px\" \/><\/figure>\n\n\n\n<p>It activates the &#8216;after_setup_theme&#8217; hook when the theme is read and executes the &#8216;remove_admin_bar&#8217; function, which hides the admin menu.<\/p>\n\n\n\n<p>Sentence to paste<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u00a0\/*Hide admin bar for regular members*\/\n\u00a0\u00a0add_action('after_setup_theme',\u00a0'remove_admin_bar');\n\u00a0\u00a0function\u00a0remove_admin_bar()\u00a0{\n\u00a0\u00a0\u00a0\u00a0if\u00a0(!current_user_can('administrator')\u00a0&amp;&amp;\u00a0!is_admin())\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0show_admin_bar(false);\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0} <\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When using WordPress, a black bar (Admin Bar) is always displayed at the top. WordPress allows users to register, and to Hide admin menu for regular members, you need to add the following line to the function.php file located in the folder of the theme you are using. It activates the &#8216;after_setup_theme&#8217; hook when the [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":1428,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182],"tags":[],"class_list":["post-6664","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shortcode-en"],"_links":{"self":[{"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/posts\/6664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/comments?post=6664"}],"version-history":[{"count":1,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/posts\/6664\/revisions"}],"predecessor-version":[{"id":7205,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/posts\/6664\/revisions\/7205"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/media\/1428"}],"wp:attachment":[{"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/media?parent=6664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/categories?post=6664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cooss.net\/en\/wp-json\/wp\/v2\/tags?post=6664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}