Hide element if WordPress user is logged in

CSS No Comments

This css trick is very handy to hide something when logged in. I used it for this. When you’re not logged in, you see the login form, but when you’re logged in, you see the logged in info. I wanted to hide this. I use DIVI, so wanted to hide a row module, but you can hide almost anything. I created a class for the module and called the class in my custom css:

.logged-in .shoutout-login {display: none !important;}

On the reference website page that I used, it had .logged_in which didn’t work for me, but I right mouse clicked and inspected the css and at very top the body code referenced .logged-in, so you may have to see what works for you.

Reference: https://css-tricks.com/forums/topic/hide-element-if-wordpress-user-logged-in/

LEAVE A COMMENT