Navigation überspringen

Hiding pages from menus and users in WordPress

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.

Menu item visible only to visitors

After a user logs in, this menu item is not visible to them anymore.

In our example, we allow users to register their account using a form. After registration, they have a custom user role called „Client“.

So, we want to hide the „Create account“ page from the menu for all „Client“ users. To achieve this you need to:

  1. Go to the ToolsetAccess Control page and click the Posts Groups tab.
  2. Create a new group with a name of your choice. We called it „Pages hidden from Clients“.
  3. 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.
  4. Set the permissions for this group so that the „Client“ users cannot read pages in this group.
Setting the access right for the Client group

After this, logged-in „Client“ users will no longer see this menu item.

The menu item is not visible to the members of Client group

Hide menu items using 3rd party plugins

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.

Disable the WordPress admin bar for different user roles

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:

  1. Go to the SettingsHide 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.
  2. Select the user role for which you want to hide the admin bar and click the Save Changes button.
Hide Admin Bar Based on User Roles plugin settings page

Updated
Oktober 12, 2023