Implement `wp_login_url()` and `wp_registration_url()` in places where `wp-login.php` is currently hard-coded.

See #31495
Props GregLone


git-svn-id: https://develop.svn.wordpress.org/trunk@34213 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2015-09-15 17:10:24 +00:00
parent 7b93c40830
commit 1a352d56f9
6 changed files with 9 additions and 9 deletions

View File

@ -14,7 +14,7 @@ require( dirname(__FILE__) . '/wp-load.php' );
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
if ( !is_multisite() ) {
wp_redirect( site_url( '/wp-login.php?action=register' ) );
wp_redirect( wp_registration_url() );
die();
}

View File

@ -494,7 +494,7 @@ EOF;
<?php endif; // end IIS/Apache code branches.
if ( !is_multisite() ) { ?>
<p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p>
<p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log In' ); ?></a></p>
<?php
}
}

View File

@ -326,7 +326,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
/** This filter is documented in wp-login.php */
$redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
} else {
$redirect_url = site_url( 'wp-login.php?action=register' );
$redirect_url = wp_registration_url();
}
wp_redirect( $redirect_url, 301 );
@ -591,7 +591,7 @@ function wp_redirect_admin_locations() {
site_url( 'login', 'relative' ),
);
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) {
wp_redirect( site_url( 'wp-login.php', 'login' ) );
wp_redirect( wp_login_url() );
exit;
}
}

View File

@ -447,7 +447,7 @@ function wp_login_form( $args = array() ) {
$login_form_bottom = apply_filters( 'login_form_bottom', '', $args );
$form = '
<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post">
<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( wp_login_url() ) . '" method="post">
' . $login_form_top . '
<p class="login-username">
<label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>

View File

@ -742,7 +742,7 @@ case 'register' :
login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
?>
<form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post" novalidate="novalidate">
<form name="registerform" id="registerform" action="<?php echo esc_url( wp_registration_url() ); ?>" method="post" novalidate="novalidate">
<p>
<label for="user_login"><?php _e('Username') ?><br />
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label>
@ -908,7 +908,7 @@ default:
}
?>
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
<form name="loginform" id="loginform" action="<?php echo esc_url( wp_login_url() ); ?>" method="post">
<p>
<label for="user_login"><?php _e('Username') ?><br />
<input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" /></label>

View File

@ -28,7 +28,7 @@ function do_signup_header() {
add_action( 'wp_head', 'do_signup_header' );
if ( !is_multisite() ) {
wp_redirect( site_url('wp-login.php?action=register') );
wp_redirect( wp_registration_url() );
die();
}
@ -669,7 +669,7 @@ $current_user = wp_get_current_user();
if ( $active_signup == 'none' ) {
_e( 'Registration has been disabled.' );
} elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
$login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( network_site_url( 'wp-signup.php' ) ) );
$login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
} else {
$stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';