Last active
May 6, 2022 08:39
-
-
Save finalwebsites/454e8f2a2e6e9db011db5122ebc850d2 to your computer and use it in GitHub Desktop.
This snippet will redirect the WordPress admin to the user profile page after a new user was added.
This file contains 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 | |
// place this code snippet to the functions.php file from your WordPress child theme | |
add_action("current_screen", "redirect_user_add"); | |
function redirect_user_add() { | |
if (!empty($_GET['id'])) { | |
$currentScreen = get_current_screen(); | |
if ($currentScreen->id == "users") { | |
wp_redirect( admin_url("/user-edit.php?user_id=".(int)$_GET['id']) ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment