Add one or both CSS snippets to your website and the relevant CSS class (‘hide-from-logged-out’ or ‘hide-from-logged-in’) to any elements you wish to hide.
For example, let’s say we wanted to hide a ‘Vendor Registration’ WordPress menu item from logged-out users.
- WordPress Dashboard > Appearance > Menus.
- Screen Options > Tick the box for ‘CSS Classes’.
- Edit the WordPress menu that contains the ‘Vendor Registration’ menu item.
- Expand the menu item.
- Add ‘hideifloggedout’ to the ‘CSS Classes’ box.
- Save your menu.
- To test, refresh your website while you are not logged in.
Hide If Logged Out
body:not(.logged-in) .hideifloggedout {
display: none !important;
}Hide If Logged In
.logged-in .hideifloggedin {
display: none !important;
}