Skip to content

Instantly share code, notes, and snippets.

@polevaultweb
Created October 14, 2019 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polevaultweb/bc44a824f158d6acfc736a41c5a74303 to your computer and use it in GitHub Desktop.
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
<?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