Title: Hide Element Condition
Last modified: May 14, 2021

---

# Hide Element Condition

 *  Resolved [karchung0930](https://wordpress.org/support/users/karchung0930/)
 * (@karchung0930)
 * [5 years ago](https://wordpress.org/support/topic/hide-element-condition/)
 * I wanna hide element by a class for anyone who did not log in to my site.
 * I found this topic in the forum:
    [https://wordpress.org/support/topic/hide-a-css-class-for-logged-in-users-in-wordpress/](https://wordpress.org/support/topic/hide-a-css-class-for-logged-in-users-in-wordpress/)
 * But it’s not working after I’ve added a class of `.logged-in`

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [tugbucket](https://wordpress.org/support/users/tugbucket/)
 * (@tugbucket)
 * [5 years ago](https://wordpress.org/support/topic/hide-element-condition/#post-14439077)
 *     ```
       .your-element { display: none; }
       .logged-in .your-element { display: block; }
       ```
   
 *  Thread Starter [karchung0930](https://wordpress.org/support/users/karchung0930/)
 * (@karchung0930)
 * [5 years ago](https://wordpress.org/support/topic/hide-element-condition/#post-14439585)
 * Thanks!
 *  [whatsgoldplus](https://wordpress.org/support/users/whatsgoldplus/)
 * (@whatsgoldplus)
 * [5 years ago](https://wordpress.org/support/topic/hide-element-condition/#post-14439957)
 * I was looking for a solution to this.
 *  Thread Starter [karchung0930](https://wordpress.org/support/users/karchung0930/)
 * (@karchung0930)
 * [5 years ago](https://wordpress.org/support/topic/hide-element-condition/#post-14440203)
 * [@tugbucket](https://wordpress.org/support/users/tugbucket/) Thank you
    [@whatsgoldplus](https://wordpress.org/support/users/whatsgoldplus/)
   Try tugbucket’s code, try this one if it’s not working.
 *     ```
       body:not(.logged-in) .hide-for-logged-out {
           display: none !important;
       }
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Hide Element Condition’ is closed to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 4 participants
 * Last reply from: [karchung0930](https://wordpress.org/support/users/karchung0930/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/hide-element-condition/#post-14440203)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
