0

I have password protected some post on a site and in order to customize the text of the password protected post I have added this codes in my theme's function file;

<?php
  function my_password_form() {
    global $post;
    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
    $o = '<form action="' . esc_url( site_url('wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
' . __( "To view this protected post, enter the password below:" ) . '
<label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" maxlength="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
</form>';
return $o;
}
add_filter( 'the_password_form', 'my_password_form' );
?>

Now in order to ward away from hackers also I have .htaccess files with password protection feature:

<Files wp-login.php>
 Satisfy All
 AuthType Digest
 AuthName "Restricted!"
 AuthDigestDomain /wp-admin/
 AuthUserFile /home3/domain/.htpasswda3
 Require valid-user
</Files>

Is there a way to bypass this htaccess rule for password protected post so that both can co-exist together.

Suggestion

Dipak Saraf
  • 127
  • 1
  • 1
  • 8
  • You could use a different url/script than wp-login.php for the password protected posts and not add any AuthX keys to htaccess to leave it unprotected. – ThatOneDude Jul 16 '15 at 18:46
  • It doesn't make sense to NOT use the built-in native functionality for WordPress password protected page. – Dipak Saraf Jul 17 '15 at 20:05

0 Answers0