How to hide buttons for logged in users in wordrpess

How to hide buttons in wordpress for logged in users?

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 in the customize page.

The class “logged-in” is already idenefied on wordpress as “only for logged in users” and it can be used to hide any button on your website for logged in users.

Here is an examble:

.logged-in .button-class{
display: none;

wordpress hide button if logged in
wordpress hide button if logged in

Hide menu item if user is logged in

You can also use “.logged-in” class to hide items from your website menu only for logged in users. All what you need to do is to add it before the code of the item you are targeting. Here is an example

.logged-in .your-item-class{
display: none;

How to hide a menu items for logged in users by using a plugin

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

wordpress hide button if logged in

Then you can hide or show each item when a user is logged in by doing these steps:

  1. Click on the item that you want to hide from your menu, then click on “enable visibility” button.
  2. Change the first option from “show” to “hide”
  3. Click on “is Administrator” and change it to “is logged in”
wordpress hide button if 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

Leave a Reply

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