Skip Navigation

[Resolved] Different menu for logged in and logged offf user

This thread is resolved. Here is a description of the problem and solution.

Problem:

I want to display different menus based on user login status and add user-friendly login and logout buttons in the menu.

Solution:

Use a plugin like WPCode to manage different menus based on user status. For the logout button, add a link with the URL http://example.com/wp-login.php?action=logout. Refer to the following documentation for generating the logout URL: https://developer.wordpress.org/reference/functions/wp_logout_url/.

Relevant Documentation:

How to Add the WordPress Logout Link to Navigation Menu: https://www.wpbeginner.com/wp-tutorials/how-to-add-the-wordpress-logout-link-to-navigation-menu/
WP Logout URL Documentation: https://developer.wordpress.org/reference/functions/wp_logout_url/

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Christopher Amirian 6 months, 1 week ago.

Assisted by: Christopher Amirian.

Author
Posts
#2697260

Hello,

How do I achieve this? I was thinking about creaating two different menus and then using a plugin such as wp code to display the correct menu according to the user logged in status?
Is there something easier?

Aslo what are the links to put for login and logout?

Thanks

Jacques

#2697289

Christopher Amirian
Supporter

Languages: English (English )

Hi Jacques,

Toolset does not have any control over the menus generated via Appearance > Menus on WordPress.

I did a Google search and there are some solutions that you can consider:

hidden link

Thanks.

#2697357

Ok thanks,

I will manage to do this.

Addititional question please : I want to add a logout button in menu.

What url should I use there, How can I make the url user friendly? Use a redirect?

Thanks,

Jacques

#2697656

Christopher Amirian
Supporter

Languages: English (English )

Hi Jacques,

That is also something you should do without Toolset as Toolset does not have such a feature.

You can look for a solution here:

hidden link

According to that documentation, you can use a code like this:

<a href="<em><u>hidden link</u></em>">Logout</a>

Here is the official WordPress documentation on such a URL generation:

https://developer.wordpress.org/reference/functions/wp_logout_url/

Thank you.

#2698177

Perfect,

Thanks a lot,

Jacques