Skip to content
Advertisement

WordPress Password Protected Page is not protected

I have a wordpress site with Kalium Theme, I have a page there which needs to be password protected. I have made several pages password protected previously with the same configuration but now a page in my website is not password protected even after making it password protected. On the WP admin panel it is showing that the page is password protected and password is set there as well. I have googled but couldn’t find out any solution. Please help me to get rid of this problem and suggest me somthing which can help me to get my page password protected.

Advertisement

Answer

Im not sure about your specific theme but by default when you select password protected, it only hides the content. i.e. the_content(). Therefore, if you wanted to password protect the whole page, update you php to something similiar to the below:

<?php

global $post;
get_header();

if ( post_password_required( $post ) ) {
      // Password protecte content.
}else{
    // Page isn't password-protected, show password prompt
    echo get_the_password_form( $post );
}

?>
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement