Password Protected Page
-
I just upgraded my site to a new version WordPress 3.9.2. I noticed that one of my page is not working the way it usually does. This page is password protected and I made changes on how it looks. When I upgraded, it doesn’t work anymore. In the password protected page, I have this code:
<?php echo "<script type='text/javascript'>\nwindow.location = 'http://www.google.com'</script>"; ?>The purpose of that one is to redirect to another page. And they go hand in hand with this code below.
Here is my old code:<?php function my_password_form() { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $o = '<form action="' . get_option('siteurl') . '/wp-pass.php" 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' ); ?>Before the upgrade, after inputting the password it redirects me to another page, which is how I wanted it to work. But take note of the action attribute of form. In the WP 3.9.2, wp-pass.php does not exist anymore so I was looking for another code. I saw this line:
action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '"But after inputting the password, it redirects me to the wp-login which is not what I wanted. I need help with this, which works the same way with the old code I’m using. I am not going to downgrade my WP or install any plugin. I just want the value of the
action=""changed. Thanks!
The topic ‘Password Protected Page’ is closed to new replies.