Password Protecting a Page / Post in Divi

Written by Dan Mossop

WordPress allows a password to be set for pages and posts. When a password is set, users will only see the content once the password has been correctly entered. Here's how to set that password when using the Divi Theme.

Set Password in the Block Editor

To set a password from within the WordPress block editor:

1. Click on "Document" in the sidebar
2. Click "Status & Visibility" to expand the visiblity options
3. Click on the current value of the "Visibility" option (e.g. "Public") to open the "Post Visibility" popup
4. Set "Post Visibility" to "Password Protected"
5. Enter your desired password in the field marked "Use a Secure Password". The Visibility setting will update to "Password Protected" and clicking elsewhere in the post will close the popup

Set Password in the Classic Editor

You may see the classic editor screen if:

* You are using an older version of WordPress
* You are using the Classic Editor plugin
* You have enabled the classic editor or the "Latest Divi Builder Experience" from within the Divi Theme Options (under "Builder > Advanced")

To set the password in the classic editor:

1. Locate the "Publish" box in the classic editor screen sidebar
2. Click on the "Edit" link next to the "Visibility" option
3. Set the "Visibility" to "Password protected"
4. Enter your desired password in the "Password:" box
5. Click "OK"

Setting the Password in the Divi Visual Builder

The Divi Visual Builder does not have an option to set the post password. However, you can still set a password by switching to the standard WordPress editor as follows:

1. Click on the "Edit Post" or "Edit Page" link in the admin bar at the top of the visual builder screen.
2. Set the password following the instructions for the Block Editor or Classic Editor above, as applicable
3. Save your changes
4. Return to the visual editor to complete editing of your post / page

Accessing a Password-protected Page / Post

If you now view your page / post, you should see an "Enter Password" box similar to the above. When you (or your users) correctly enter the password you set for the page / post, the main content will be revealed.

Styling the Password Entry Form

Divi doesn't offer much in the way of options for changing the look of the password entry form or password protected page / post.

To address this, I created the Divi Password Box module, which replaces the default Divi password entry form with a highly-configurable module, and enables editing of the entire password protected page / post using the Divi Builder.

Secure Your Content with Style Using Divi Password Box!

Upgrade the appearance and functionality of your password-protected pages with the Divi Password Box module! Easily customize the password entry experience to ensure your site looks fantastic and stays secure, all while benefiting from Divi's flexible design options.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

6 Comments

  1. Hey Dan,

    I'm trying to figure out why this doesn't work when you want to password protect a woocommerce product. Any ideas?

    Reply
    • Hi Jared, I'm not sure… I did a test and was able to password protect a woocommerce product without any issues. One thing to watch out for is caching – if the page is cached the unprotected version of the page might be cached and getting used each time. In general it's a good idea to exclude any password protected pages from being cached (you can usually configure this in the settings of any caching plugin, etc, that you're using). If that doesn't seem to be the issue, is there any chance you're able to share a link to the page you're working on (privately via the contact form, if you like), so that I can take a look? Also, if you can, let me know what seems to be failing (i.e. you can't find the place to enter the password, or the password box doesn't show on the front end, etc). Thanks!

      Reply
  2. I've built the page with divi and everything looks great. I password protect it and all formatting gets messed up. How can I fix this?

    Reply
    • Hi Amanda, the first thing I'd do is ensure that the page is excluded from caching in any performance plugins you use. If that doesn't help, is there any chance you're able to send through a link to the page, and a copy of the password, so that I can take a look for you? You can send it via the contact form if you don't want to share it here. Thanks!

      Reply
  3. My password protection is not working. It keeps referring back to the password prompt. Yes i have the correct password. Any ideas?

    Reply
    • Hey Andy, two things to check are:

      * Is the page cached? If so, it might be that the password prompt version of the page is being cached and used regardless of the password validity. In this case, excluding the page from the cache (most caching plugins / solutions will have a way to exclude certain pages), and clearing the cache should solve it.
      * Are cookies blocked? WordPress sets a cookie when the correct password is entered, but if you have cookies disabled in the browser, or are using a cookie acceptance plugin (such as are commonly used for GDPR compliance) and have previously clicked to disallow cookies, then WordPress would not be able to set the cookie it usually does. Temporarily disabling any such plugin and ensuring the browser is configured to accept cookies should show reveal if that's the case.

      If neither of those things help, perhaps you could send me a link to the page you're working on (along with the password) via the contact form so that I can take a look? Thanks!

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

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

We may earn a commission when you visit links on our website.