WordPress.org

Make WordPress Core

Ticket #35177: 35177.patch

File 35177.patch, 2.8 KB (added by johnbillion, 4 years ago)

Patch by khag7

  • general-template.php

     
    260260}
    261261
    262262/**
     263 * Returns the URL that receives login and logout post data
     264 *
     265 * @since 4.4.1
     266 *
     267 * @param string $scheme     URL scheme to use.
     268 * @param bool   $network Whether to use network_site_url instead of site_url
     269 * @return string A URL.
     270 */
     271function wp_login_handler_url( $scheme = 'login' , $network = false ) {
     272        $handler_url = $network === true ? network_site_url( 'wp-login.php', $scheme ) : site_url( 'wp-login.php', $scheme );
     273
     274        /**
     275         * Filter the login handler URL.
     276         *
     277         * @since 4.4.1
     278         *
     279         * @param string $handler_url    The login handler URL.
     280         * @param string $scheme     URL scheme to use.
     281         * @param bool   $network Whether to use network_site_url instead of site_url
     282         */
     283        return apply_filters( 'login_handler_url', $handler_url, $scheme, $network );
     284}
     285
     286/**
    263287 * Display the Log In/Out link.
    264288 *
    265289 * Displays a link, which allows users to navigate to the Log In page to log in
     
    308332                $args['redirect_to'] = urlencode( $redirect );
    309333        }
    310334
    311         $logout_url = add_query_arg($args, site_url('wp-login.php', 'login'));
     335        $logout_url = add_query_arg($args, wp_login_handler_url() );
    312336        $logout_url = wp_nonce_url( $logout_url, 'log-out' );
    313337
    314338        /**
     
    332356 * @return string A log in URL.
    333357 */
    334358function wp_login_url($redirect = '', $force_reauth = false) {
    335         $login_url = site_url('wp-login.php', 'login');
     359        $login_url = wp_login_handler_url();
    336360
    337361        if ( !empty($redirect) )
    338362                $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
     
    368392         *
    369393         * @param string $register The user registration URL.
    370394         */
    371         return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
     395        return apply_filters( 'register_url', add_query_arg( 'action', 'register', wp_login_handler_url() ) );
    372396}
    373397
    374398/**
     
    471495        $login_form_bottom = apply_filters( 'login_form_bottom', '', $args );
    472496
    473497        $form = '
    474                 <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( set_url_scheme( wp_login_url(), 'login_post' ) ) . '" method="post">
     498                <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( wp_login_handler_url('login_post') ) . '" method="post">
    475499                        ' . $login_form_top . '
    476500                        <p class="login-username">
    477501                                <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
     
    510534                $args['redirect_to'] = $redirect;
    511535        }
    512536
    513         $lostpassword_url = add_query_arg( $args, network_site_url('wp-login.php', 'login') );
     537        $lostpassword_url = add_query_arg( $args, wp_login_handler_url( 'login', true ) );
    514538
    515539        /**
    516540         * Filter the Lost Password URL.