How to Password Protect Content created by PageLines Platform Builder

PageLines is a powerful front-end design tool that allows you to customize your WordPress website as quickly as possible with real-time drag and drop.

When it comes to password protection, only the content of the post/page will be protected by default. The PageLines layout (or template) applied to that post/page will still be visible. Fortunately, it’s possible to protect the whole PageLines layout/template with the Password Protect WordPress plugin.

In order to block all of the PageLines sections with a password form, you need to add the following code snippet into your (child) theme’s functions.php file.

add_action('pl_region_template', 'ppwp_pl_maybe_render_password_form', 8 );

function ppwp_pl_maybe_render_password_form() {
     if ( ! is_singular() ) {
         return;
         }
     if ( post_password_required() ) {
         echo get_the_password_form();
         exit();
         }
}
Lasted updated on July 20, 2020