WordPress MU Domain Mapping
[resolved] Worpdress update broke protective pages. (2 posts)

  1. themantimeforgot
    Posted 3 years ago #

    Yesterday we updated our word press multisite instance and all associated plugins. WordPress seems to have changed how they handle password protected pages which has created an issue where after typing in the password (Correct or incorrect) on a page you are presented with a 404 error.

    On submission the site is redirecting is being sent to "<siteurl>/wp-login.php?action=postpass" producing the 404 error.

    Is anyone else experiencing this issue?


  2. themantimeforgot
    Posted 3 years ago #

    Found this on the forums. Apparently the issue is with the new way password protected forms work and the use of https. For me the issue was the opposite of what the individual who posted it was. My issue is the https has to be removed so I altered the code below to reflect that. See below:

    https admin vs http site issue:
    I spent a lot of time looking for a problem with our theme, but our issue turned out to be something entirely different. Maybe this post will help someone else.

    If your setup runs SSL on the admin portion of your site, but the public-facing site is not secured, the password cookie isn't being recognized. If you put the "s" in "http" on the page with the password and it works, you can solve this issue by rewriting the password form in your theme's functions.php file like this:

    add_filter( 'the_password_form', 'custom_password_form' );
    function custom_password_form() {
    	$url = get_option('siteurl');
    	$url = preg_replace("/^https:/", "http:", $url);
    	global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $o = '<form class="protected-post-form" action="' . $url . '/wp-login.php?action=postpass" method="post">
    ' . __( "<h2>Enter password</h2>
    <p>This content is password protected. To view it please enter the password below:</p>" ) . '
    <label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" class="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" /> </form>
    return $o;

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress MU Domain Mapping
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic