Custom password form allows unlock two posts with the same password

I use this custom password form in my theme:add_filter( 'the_password_form', 'custom_password_form'

I use this custom password form in my theme:

add_filter( 'the_password_form', 'custom_password_form' );
function custom_password_form() {
    $o = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">'.'
        <div class="l-password-protect">
            <div class="c-password-protect">
                <input name="post_password" id="password"  class="c-input" type="password" size="20" required placeholder="hasło"/>
                <input type="submit" name="Submit" class="c-button" value="' . esc_attr__( 'Submit', 'behold-universal-one' ) . '" />
            </div>
        </div>
    </form>
    ';
    return $o;
}

but when I have more than one post with the same password, after entered it I can unlock those two posts at once. Where's the problem?

EDIT

I modify my code based on this / but problem is still the same.

add_filter( 'the_password_form', 'custom_password_form' );
function custom_password_form($post = 0) {
    $post   = get_post( $post );
    $label  = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID );
    $output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">
    <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form>
    ';
return $output;
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745624635a4636732.html

相关推荐

  • Custom password form allows unlock two posts with the same password

    I use this custom password form in my theme:add_filter( 'the_password_form', 'custom_password_form'

    22天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信