Password Protected Page

Add this code outside the loop on the template page to enable password protection.

<!–password protect code –>
<?php if ( ! post_password_required( $post ) ) { ?>
<!–password protect code –>

CONTENT LOOP

<!– end of the password protect –>
<?php
} else {
echo get_the_password_form();
} ?>
<!– end of the password protect –>

Leave a Reply