{"id":1966609,"date":"2021-02-26T15:22:35","date_gmt":"2021-02-26T15:22:35","guid":{"rendered":"https:\/\/toolset.com\/?post_type=course-lesson&#038;p=1966609"},"modified":"2023-10-12T14:20:39","modified_gmt":"2023-10-12T14:20:39","slug":"hiding-pages-from-menus-and-users","status":"publish","type":"course-lesson","link":"https:\/\/toolset.com\/es\/course-lesson\/hiding-pages-from-menus-and-users\/","title":{"rendered":"Hiding pages from menus and users"},"content":{"rendered":"\n<p>You will need the <strong>Toolset Access<\/strong> plugin.<\/p>\n\n\n\n<p>As you limit access to a page so that users with specific roles cannot access it, Toolset will automatically hide it from the menus for these users.<\/p>\n\n\n\n<p>Let&#8217;s consider a site that allows visitors to create an account and then log into it. In the menu, we want to show the &#8220;Create account&#8221; item only to site visitors that are not logged in.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\" tb-image tb-image-media tb-image-frame-none aligncenter\" data-toolset-blocks-image=\"af62e896af8d54bc5aa3f34e4dfd9c28\"><a href=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/menu-wit-all-items.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/menu-wit-all-items-500x208.png\" alt=\"\" class=\"wp-image-1966645\"\/><\/a><figcaption><div class=\"tb-image-caption\">Menu item visible only to visitors<\/div><\/figcaption><\/figure>\n<\/div>\n\n\n<p>After a user logs in, this menu item is not visible to them anymore.<\/p>\n\n\n\n<p>In our example, we allow users to <a href=\"https:\/\/toolset.com\/es\/course-lesson\/creating-forms-for-registering-users\/\">register their account using a form<\/a>. After registration, they have a <a href=\"https:\/\/toolset.com\/es\/course-lesson\/setting-up-custom-roles-for-members\/\">custom user role<\/a> called &#8220;Client&#8221;.<\/p>\n\n\n\n<p>So, we want to hide the &#8220;Create account&#8221; page from the menu for all &#8220;Client&#8221; users. To achieve this you need to:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to the <strong>Toolset<\/strong> \u2192 <strong>Access Control<\/strong> page and click the <strong>Posts Groups<\/strong> tab.<\/li>\n\n\n\n<li>Create a new group with a name of your choice. We called it &#8220;Pages hidden from Clients&#8221;.<\/li>\n\n\n\n<li>Add the &#8220;Create account&#8221; page to your new group. To be able to do this, make sure to <a href=\"https:\/\/toolset.com\/course-lesson\/restricting-access-to-pages\/#bring-pages-under-access-control\">bring the related post type under Access&#8217;s control<\/a>.<\/li>\n\n\n\n<li>Set the permissions for this group so that the &#8220;Client&#8221; users cannot read pages in this group.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\" tb-image tb-image-media tb-image-frame-none aligncenter\" data-toolset-blocks-image=\"50f822ff0e272a37cc6303bdc21576f0\"><a href=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/toolset-access-control-hide-page-for-user-role.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/toolset-access-control-hide-page-for-user-role-500x354.png\" alt=\"\" class=\"wp-image-1968163\"\/><\/a><figcaption><div class=\"tb-image-caption\">Setting the access right for the Client group<\/div><\/figcaption><\/figure>\n<\/div>\n\n\n<p>After this, logged-in &#8220;Client&#8221; users will no longer see this menu item.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\" tb-image tb-image-media tb-image-frame-none aligncenter\" data-toolset-blocks-image=\"f84c2f33105f0f904788a9a50bb56302\"><a href=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/menu-with-hidden-item.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/menu-with-hidden-item-500x208.png\" alt=\"\" class=\"wp-image-1966655\"\/><\/a><figcaption><div class=\"tb-image-caption\">The menu item is not visible to the members of Client group<\/div><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Hide menu items using 3rd party plugins<\/h2>\n\n\n\n<p>In some cases, you might need a more granular control of which items appear in your menus. There are many third-party plugins, like <a href=\"https:\/\/wordpress.org\/plugins\/if-menu\/\">If Menu<\/a>, that can help you do this.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Disable the WordPress admin bar for different user roles<\/h2>\n\n\n\n<p>Sometimes you may want to disable the WordPress admin bar for certain groups of users.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\" tb-image tb-image-media tb-image-frame-none aligncenter\" data-toolset-blocks-image=\"dcfddb662f7442cda1bd91a5883b20c5\"><a href=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/wordpress-admin-bar.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/wordpress-admin-bar-500x241.png\" alt=\"\" class=\"wp-image-1968127\"\/><\/a><\/figure>\n<\/div>\n\n\n<p>You can easily do this by using an additional plugin. In our example, we\u2019ll use the <a href=\"https:\/\/wordpress.org\/plugins\/hide-admin-bar-based-on-user-roles\/\">Hide Admin Bar Based on User Roles<\/a> plugin to accomplish this. After installing the plugin, do the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to the <strong>Settings<\/strong> \u2192 <strong>Hide Admin Bar Settings<\/strong> page. In our case, we want to hide the admin bar for a specific role so we\u2019ll use the <strong>Hide admin bar for selected user roles<\/strong> option.<\/li>\n\n\n\n<li>Select the user role for which you want to hide the admin bar and click the <strong>Save Changes<\/strong> button.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\" tb-image tb-image-media tb-image-frame-none aligncenter\" data-toolset-blocks-image=\"5ef60313e3ea5a8fbb73a90ffc1690f2\"><a href=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/hide-admin-bar.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/toolset.com\/wp-content\/uploads\/2021\/02\/hide-admin-bar-500x323.png\" alt=\"\" class=\"wp-image-1966705\"\/><\/a><figcaption><div class=\"tb-image-caption\">Hide Admin Bar Based on User Roles plugin settings page<\/div><\/figcaption><\/figure>\n<\/div>\n\n\n<p><\/p>\n","protected":false},"author":56710,"featured_media":1966713,"template":"","related-lesson":[],"class_list":["post-1966609","course-lesson","type-course-lesson","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/course-lesson\/1966609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/course-lesson"}],"about":[{"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/types\/course-lesson"}],"author":[{"embeddable":true,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/users\/56710"}],"version-history":[{"count":7,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/course-lesson\/1966609\/revisions"}],"predecessor-version":[{"id":2652235,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/course-lesson\/1966609\/revisions\/2652235"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/media\/1966713"}],"wp:attachment":[{"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/media?parent=1966609"}],"wp:term":[{"taxonomy":"related-lesson","embeddable":true,"href":"https:\/\/toolset.com\/es\/wp-json\/wp\/v2\/related-lesson?post=1966609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}