Created
October 14, 2019 08:03
-
-
Save polevaultweb/bc44a824f158d6acfc736a41c5a74303 to your computer and use it in GitHub Desktop.
Redirect to the account tab after saving the setting in WP User Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wp_redirect', function ( $location ) { | |
if ( ! isset( $_POST['wpum_form'] ) || 'profile' !== $_POST['wpum_form'] ) { | |
return $location; | |
} | |
if ( empty( $_POST['_wp_http_referer'] ) ) { | |
return $location; | |
} | |
$parts = explode( '?', $location ); | |
array_shift( $parts ); | |
$url = home_url( $_POST['_wp_http_referer'] ); | |
$url .= '?' . $parts[0]; | |
return $url; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment