WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Comments box appearing on password page (3 posts)

  1. sonesh
    Member
    Posted 1 year ago #

    I'm new to wordpress, but have solved many of my problems by reading this forum, except one.

    I've password protected a lot of my pages, which is working fine, but I've just noticed pages which can be commented on, show the "Leave a Reply" form even if you've not entered the password.

    http://wedding.sonesh.co.uk/your-contributions/sign-our-guestbook/

    Pressing submit takes you to a blank page and doesn't post the comment, but works fine if you've entered the password, but I can see this being a problem if people are too lazy to enter the password.

    Any ideas?

  2. keesiemeijer
    moderator
    Posted 1 year ago #

    Look for this in your theme's page.php:

    <?php comments_template(); ?>

    And change it to this so the comment form only displays on pages that are not password protected and on pages where the password has been provided [untested]:

    <?php
    if(!post_password_required( $post )) {
    comments_template();
    }
    ?>

    http://codex.wordpress.org/Function_Reference/post_password_required

  3. sonesh
    Member
    Posted 1 year ago #

    It actually seems to have fixed itself. Now that people have put comments in, the form has been replaced with:

    This post is password protected. Enter the password to view comments."

    Thanks anyway

Topic Closed

This topic has been closed to new replies.

About this Topic