Show WordPress menus only for logged in users
The User Menus Plugin gives you additional menu options that allow more precise control over the visibility of your menu links. You can use it to easily create menu links that are only visible to logged-in users or that require certain user roles such as administrator.
The plugin is particularly helpful for websites with many logged-in users, for example an online shop or a community. But the plugin can also be useful for simple blogs, e.g. to create hidden links for the editors only.
Download the plugin
The plugin can be downloaded from the official WordPress.org directory:
Make WordPress menus visible only to logged in users
After installing the plugin, additional options are available in the admin area to individually define the visibility of each menu item. With the standard value “Everyone”, every menu link is visible to all visitors and users.
Alternatively, the menu element can only be displayed for logged-out visitors or only for logged-in users. With the latter, a second option can also be used to define precise user roles for the visibility of the link.
Show login and logout links in the menu
But the plugin can do even more. In addition to the settings for visibility, it also provides a new type of User Links for menu elements. This allows a login and logout link to be easily added to the menu.
Of course, these links behave intelligently, ie the login link is only displayed for logged-out visitors, the logout link only for logged-in users.
There is an additional option for the login and logout link to redirect users to a specific page after logging in or out. In addition to the current page or the start page, a custom URL can also be entered.
Create menu links with user variables
The plugin also provides extra variables to display the name of the logged in user directly in the Link menu. This allows you to create links with “Hello% User%” in the menu. A total of 6 different variables are currently available, including:
- {username} - account name
- {first_name} - first name
- {email} - email address
If you find the plugin useful, the User Switching Plugin could also be of interest to you.