If your site allows users to log in, it's useful to hide certain pages from menus and users. For example, it makes sense hiding the "Create account" page for logged-in users.
You will need the Toolset Access plugin.
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.
Let’s consider a site that allows visitors to create an account and then log into it. In the menu, we want to show the « Create account » item only to site visitors that are not logged in.
After a user logs in, this menu item is not visible to them anymore.
So, we want to hide the « Create account » page from the menu for all « Client » users. To achieve this you need to:
- Go to the Toolset → Access Control page and click the Posts Groups tab.
- Create a new group with a name of your choice. We called it « Pages hidden from Clients ».
- Add the « Create account » page to your new group. To be able to do this, make sure to bring the related post type under Access’s control.
- Set the permissions for this group so that the « Client » users cannot read pages in this group.
After this, logged-in « Client » users will no longer see this menu item.
In some cases, you might need a more granular control of which items appear in your menus. There are many third-party plugins, like If Menu, that can help you do this.
Sometimes you may want to disable the WordPress admin bar for certain groups of users.
You can easily do this by using an additional plugin. In our example, we’ll use the Hide Admin Bar Based on User Roles plugin to accomplish this. After installing the plugin, do the following:
- Go to the Settings → Hide Admin Bar Settings page. In our case, we want to hide the admin bar for a specific role so we’ll use the Hide admin bar for selected user roles option.
- Select the user role for which you want to hide the admin bar and click the Save Changes button.