Make "Add New User" redirect to user's profile
wordpress
Solution
`wp_redirect` is filterable, so you could hook in to redirect after a user was successfully added. I tested the following, might need a few tweaks but it does the trick:
add_filter( 'wp_redirect', 'wp_redirect_after_user_new', 1, 1 );
function wp_redirect_after_user_new( $location )
{
global $pagenow;
if( is_admin() && 'user-new.php' == $pagenow )
{
$user_details = get_user_by( 'email', $_REQUEST[ 'email' ] );
$user_id = $user_details->ID;
if( $location == 'users.php?update=add&id=' . $user_id )
return add_query_arg( array( 'user_id' => $user_id ), 'user-edit.php' );
}
return $location;
}
Problem
I'm wondering if it's possible that when you create a new user `user-new.php` you're being redirect to the user's profile instead of to `users.php` I'm having some custom fields who only show up when you edit a user, so to make the workflow more easy I would like that the admin gets redirect to the user's profile so he can add those custom fields instantly.