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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45398 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-05-24 01:32:19 +00:00
parent d1be6e34c9
commit 7afa6c2057

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().
*/
function wp_logout_url( $redirect = '' ) {
$args = array( 'action' => 'logout' );
$args = array();
if ( ! empty( $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' );
/**
@ -558,12 +558,12 @@ function wp_login_form( $args = array() ) {
* @return string Lost password URL.
*/
function wp_lostpassword_url( $redirect = '' ) {
$args = array( 'action' => 'lostpassword' );
$args = array();
if ( ! empty( $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.