Login and Registration: Pass the action to `site_url()` in `wp_logout_url()` and `wp_lostpassword_url()`:

* Make `site_url` filter in `wp_logout_url()` aware of the `logout` action.
* Make `network_site_url` filter in `wp_lostpassword_url()` aware of the `lostpassword` action.

Props jfarthing84.
Fixes #43407.
Built from https://develop.svn.wordpress.org/trunk@45398


git-svn-id: http://core.svn.wordpress.org/trunk@45209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-05-24 01:33:52 +00:00
parent 6dc1ced79c
commit e3bb526606
2 changed files with 5 additions and 5 deletions

View File

@ -352,12 +352,12 @@ function wp_loginout( $redirect = '', $echo = true ) {
* @return string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url(). * @return string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url().
*/ */
function wp_logout_url( $redirect = '' ) { function wp_logout_url( $redirect = '' ) {
$args = array( 'action' => 'logout' ); $args = array();
if ( ! empty( $redirect ) ) { if ( ! empty( $redirect ) ) {
$args['redirect_to'] = urlencode( $redirect ); $args['redirect_to'] = urlencode( $redirect );
} }
$logout_url = add_query_arg( $args, site_url( 'wp-login.php', 'login' ) ); $logout_url = add_query_arg( $args, site_url( 'wp-login.php?action=logout', 'login' ) );
$logout_url = wp_nonce_url( $logout_url, 'log-out' ); $logout_url = wp_nonce_url( $logout_url, 'log-out' );
/** /**
@ -558,12 +558,12 @@ function wp_login_form( $args = array() ) {
* @return string Lost password URL. * @return string Lost password URL.
*/ */
function wp_lostpassword_url( $redirect = '' ) { function wp_lostpassword_url( $redirect = '' ) {
$args = array( 'action' => 'lostpassword' ); $args = array();
if ( ! empty( $redirect ) ) { if ( ! empty( $redirect ) ) {
$args['redirect_to'] = urlencode( $redirect ); $args['redirect_to'] = urlencode( $redirect );
} }
$lostpassword_url = add_query_arg( $args, network_site_url( 'wp-login.php', 'login' ) ); $lostpassword_url = add_query_arg( $args, network_site_url( 'wp-login.php?action=lostpassword', 'login' ) );
/** /**
* Filters the Lost Password URL. * Filters the Lost Password URL.

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-45397'; $wp_version = '5.3-alpha-45398';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.