How to Show Different Menus to Different WordPress User Roles?

It becomes really difficult to manage different user roles on the website. If you are one from those who are running forum or a membership website then you might come across certain situations where you wish to show different menus to different user roles. The things can become really simpler if you are working with WordPress. Though there are a number of plugins that can help you out with this, but WordPress provides you capabilities to manage the user roles efficiently by default.

Different User Roles in WordPress

It is necessary to learn about the 5 different types of user role available on a WP website so that you can assign the role to new join easily and provide limited capabilities.

  • Administrator: The administrator holds the supreme power and can manage posts, pages, comments, plugins, themes, settings, and assign different roles to the users. The administrator is powerful enough to delete the complete blog.
  • Editor: The editor can publish the pages or the posts and can manage them as well. He/she can upload the files and moderate the comments too, and can even manage the posts of other users on the blog too.
  • Author: The author is allowed to upload the files and write, publish & edit own posts. The author cannot edit someone else’s posts.
  • Contributor: The contributor is allowed to write the posts, but doesn’t hold the capability to publish the post. The contributor’s post is submitted for the review to the administrator or editor of the site.
  • Subscriber: A subscriber can only read the comments and have capabilities to write the comments as well.

Imagen 1.png

WordPress has different menu items for different roles by default. Here are the capabilities of different users on a WP blog.

Imagen 2.png

Though this is the default function of just any WP blog, you can still give different menu access to the logged-in and logged-out users. All you have to do is create different menus for different users.

Multiple Menus Creation in WordPress

You are allowed to create different menu for same location and this can be done by following the simple steps.

  • Click on ‘Appearance’ option.

Imagen 3.png

  • Go to ‘Menus’ option.

Imagen 4.png

  • Now create two different menus for different user type.

Imagen 5.png

  • After the menus have been created, you need to paste a code in the theme coding for assigning different roles to the users.

The following code must be added inside the site specific plugin or the functions.php theme file for providing yourself with capability to show different menus to different users.

Imagen 6.png

Once the code has been inserted at the right place, the users who are logged-in will see different menus while the users who are logged-out will see a different menu.

The Bottom Line

Assigning different menus to different user roles can be done easily on WordPress as the option is present by default. But if you wish to give different menu access to logged-in and logged-out users then you need to apply certain code to make the things fully functional.

One comment on “How to Show Different Menus to Different WordPress User Roles?

Leave a Reply

Your email address will not be published. Required fields are marked *