Support » Fixing WordPress » Add Captcha to Password Protected Page

  • I need to have a protected page in my WordPress site that is Password and Captcha protected. The Captcha is to prevent brute force attacks on the password, so they need to be displayed simultaneously. I’ve thought of requiring users to register and set the page to “Private”, but they’d need Editor access to see it which isn’t appropriate.

    The only plugin I’ve found that came close would allow me to hide content requiring a password or captcha, but not both.

    Is there a plugin/way to extend the WordPress OOTB “Protected” page function to display a Captcha as well? Or a plugin that I could use to add a Password with Captcha to a specific page?

Viewing 8 replies - 1 through 8 (of 8 total)
  • I recommend Google’s Nocaptcha/Recaptcha system. It’s easy on users and works quite well.

    https://www.google.com/recaptcha/admin#

    There are a few plugins that handle the Google system, including https://wordpress.org/plugins/google-captcha/

    Thread Starter jacquie9019

    (@jacquie9019)

    Hi vahost,

    That’s the exact type of Captcha I’d like to add! I’m actually already using a similar plugin for my admin login. But the plugins I’ve found only seem to add the Captcha to the OOTB WordPress forms like login, password reset, comments etc.

    How would I add it to the password form for a protected page?
    https://codex.wordpress.org/Using_Password_Protection

    Did you manage to add it?

    Thread Starter jacquie9019

    (@jacquie9019)

    Unfortunately no. I’d fallen back to creating a common user that would run through the log-in page, but that is creating problems of it’s own and is not a great solution for a simple password page.

    I did start a topic with the “No CAPTCHA reCAPTCHA” plugin requesting whether they would consider adding the feature to add Captcha’s to Protected Pages, but haven’t heard anything there either.

    Have you had any luck or discovered other alternatives?

    Thread Starter jacquie9019

    (@jacquie9019)

    Unfortunately no. I’d fallen back to creating a common user that would run through the log-in page, but that is creating problems of it’s own and is not a great solution for a simple password page.

    I did start a topic with the “No CAPTCHA reCAPTCHA” plugin requesting whether they would consider adding the feature to add Captcha’s to Protected Pages, but haven’t heard anything there either.

    Have you had any luck or discovered other alternatives?

    That is so unfortunate. I haven’t found any alternatives so far. Google Captcha (reCAPTCHA) plugin by BestWebSoft includes a feature within the post editor which lets you insert this code in a post/page:[bws_google_captcha], supposedly to add a Captcha to the post/page, but it does not work for me or maybe I am applying it incorrectly. Have you tried it?

    Thread Starter jacquie9019

    (@jacquie9019)

    I did see that one but didn’t try it out as it only adds the Captcha to a page. On a password protected page the Captcha wouldn’t be shown until the correct password was entered which defeats the purpose of having the Captcha.

    NoSuchThing

    (@nosuchthing)

    You could try it like this… seems to work for me. In your functions.php add this filter. This adds the BWS recaptcha shortcode to your form.

    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">
        ' . __( "Please input password to gain access to this content" ) . '
        <label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" maxlength="20" />&nbsp;<input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
        [bws_google_captcha]
        </form>
        ';
        return $o;
    }
    add_filter( 'the_password_form', 'my_password_form' );
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add Captcha to Password Protected Page’ is closed to new replies.