To hide any button in your wordpress website for logged in users you need to add a css class called “.logged-in” into your theme additional css which is located in the customize page.
The class “logged-in” is already idenified on wordpress as “only for logged in users” and it can be used in various ways to hide any element from your website.
Here are some quick examples on hiding a button for logged in/ logged out users:
Hide a button for all users (logged in and logged out)
Hide a button only for logged in users and show for logged out
Hide a button for logged out users and show for logged in
#this will hide it for all users
# this will show it for logged in users only
You can also use “.logged-in” class to hide items from your website menu only if user is logged in. All what you need to do is to add it before the code of the item you are targeting. Here is an example
If you don’t want to use css codes you can install a wordpress plugin called If Menu – Visibility control for Menu Items. it will help you to hide or show any item on your menu when a user is logged in.
After you install it, you go to your menu from appearance → menus
Then you can hide or show each item when a user is logged in by doing these steps:
- Click on the item that you want to hide from your menu, then click on “enable visibility” button.
- Change the first option from “show” to “hide”
- Click on “is Administrator” and change it to “is logged in”
If Menu plugin also can be used to hide menu item for other rules. For example you can hide/show items for your menu if the user is an vendor or editor, author, subscriber… etc
Another way of hiding buttons for logged in users is by using php codes, and for that you can check this article from wordpress developers resources
if you’ve got any thoughts on how to hide elements in wordpress for logged in users , or any questions, feel free to share them in the comments down below. i do my best to reply to everyone!.
And if you enjoyed this article, it’d be great if you could consider sharing it on social media, or adding a link to it from your website or blog.
Thanks for reading..
People also search for
wordpress if user logged in
wordpress button class
wordpress hide menu
wordpress menu buttons
if user logged in wordpress
wordpress button classes
wordpress if user is logged in
hide menu wordpress
wordpress is user logged in
wordpress user logged in