How to Hide a Section for Logged out Users in Divi/Elementor.

Sep 15, 2019 | Divi Tips, WordPress Tutorial | 13 comments

Samar Jamil

Hi guys.

In this tutorial, I am going to show you how you can hide a Specific section for Logged out users in Divi and Elementor or any other Page Builders out there. There are many reasons why you wanted to do this so this is a solution for you.

It’s so easy no need of any plugin we just need to add a class to that section(that will not available for logged out user) and a few lines of CSS.

First of all, we need to add a class to that section which will be: hide-for-logged-out.

Then add a Code Module.

And paste this CSS in the that Box(You can add this code anywhere you paste your CSS codes just make sure to remove the style tags when you paste it in Theme Options and other places).

      body:not(.logged-in) .hide-for-logged-out {
    display: none !important;

Now, logout from your site and see that Section will not appear as you’re logged out.

In Elementor

The same thing goes for the Elementor as well just add class to that section:hide-for-logged-out

Now add a new module as HTML and paste that code in this box.

Now try to logout from your site and see that Section will not appear as you’re Logged out.

So that’s it for this tutorial Hope you’ve liked it and if you found any problem just put a comment in the section below and I’ll try to help you as soon as possible.

Feeling Generous

Give me a Cup of Coffee and have a gift for giving me a Coffee

Buy me a coffeeBuy me a coffee

Written by : Samar Jamil


Get Freebies and new blog post notification straight in your inbox!


  1. Incze Ábel

    hi i would like the opposite, but isnt work when i change the words. I would like to hedi when logged in and sho when logged out. what can i do? thx

  2. Mauricio Gil-Angove

    Hi Samar! great job, but if i want to hide the section just for logg in users?

    • Samar Jamil

      Hi Mauricio,
      Very soon I’ll post a video on my Channel where I’ll show you in detail how to do it. You’ll have full control. And I’ll be using Divi Supreme Plugin to do so. You can follow the link to get a 10% discount.
      Have a great day!

    • Philippe Sudan

      There you go Mauricio, add this to your child CSS stylesheet or in your theme

      /* Hide a class if logged-in or out */

      /* Class hide-for-looged-out */
      body:not(.logged-in) .hide-for-logged-out {
      display: none !important;
      /* Class hide-for-looged-in */
      body.logged-in .hide-for-logged-in {
      display: none !important;

      Thanks Samar, nice job!


        I am facing an issue in Elementor
        If I use the hide for logged in, then I am not able to see the section in editor.

        • Samar Jamil

          Hi Shailendra
          That’s how it works. You can use Layer View to edit your section/widgets after inserting this code.

  3. Jéssica

    Thaaaanks!!! you save-me, and it’s soo easy. Thank you, really.

    • Samar Jamil

      You’re very welcome. I’m glad that It was helpful to you.

  4. chas

    This also saved me $25 a year for a plug in i would have to purchase. THANK YOU!

    • Samar Jamil

      That’s awesome, I’m glad that this was helpful for you!

      • Tanveer Malik

        I wonder if these are kind of sudo classes provided by Elementor or other similar page builders?, I am interested in reading a bit more about these classes if that’s the case.
        I am interested in hiding a particular section from my header if it’s not ‘Front Page’ or ‘Home Page’, any help will be highly appreciated.

        • Samar Jamil

          Hi Tanveer
          Yup those pseudo-classes are provided by WordPress, I’m pretty sure about that.
          And regarding your question to hide a specific part of the header on Homepage/Frontpage, well you can easily do that with Theme Builder. Just create a new template and assign it to the Homepage then duplicate the Global Header to create a custom Header for homepage only and remove the section you don’t want to show on the Homepage.
          Hope that helps!

  5. mone27

    Thanks really useful!
    It a simple and versatile system (and I guess should work also with other page builders)


Submit a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This