• I have found this code from here

    When I add this, its redirecting to /wp-login.php?action=postpass and showing a complete white screen.

    Can anyone please see if there’s any problem in the code? and give the correct one so that it works correctly.

    I am adding the code below.

    –––––––––––––––––––––––––––––––––––––

    function my_custom_password_form() {
    		global $post;
    		$label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID );
    		$output = '
    		<div class="pa-lck-section">
    			<div class="container">
    				<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="form-inline post-password-form" method="post">
    					<p>' . __( '<b>This is a subscribers only content.</b><br> If you are already subscribed then enter your key you have received via mail and enjoy surfing. Incase you have not subscribed yet, please subscribe to receive your access key.' ) . '</p>
    					<label for="' . $label . '">' . __( 'Enter Access Key' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" class="form-control" /></label><button type="submit" name="Submit" class="button-primary">' . esc_attr_x( 'Submit', 'post password form' ) . '</button>
    				</form>
    			</div>
    		</div>';
    	return $output;
    }
    add_filter('the_password_form', 'my_custom_password_form', 99);
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Your code works as expected on my site. Define WP_DEBUG as true in wp-config.php so you can see what error is causing the blank white screen.

Viewing 1 replies (of 1 total)

The topic ‘Password protect visibility page error’ is closed to new replies.