Use CSS to Hide Any Content From Logged Out Users

Recommendation

Learn why I switched to WPCodeBox for managing code snippets for myself and for my clients.

Instructions

Snippet Type: CSS

  1. Copy the snippet.
  2. Add the snippet using WPCodeBox.
  3. Follow any customization notes provided.
  4. Save the snippet.
  5. Enable the snippet.
  6. Test.

Snippet

Customization Notes

Add this CSS snippet to your website and add the ‘hideviacss’ CSS class to any elements you wish to hide.

				
					body:not(.logged-in) .hideviacss {
    display: none !important;
}