Hi,
I think the above code can approach what you want, just change it like below:
wp_redirect( 'http://<your_domain>/<path>/privatepage/'.$current_user->user_login);
*The property “user_login” means user name.
ref: document
-
This reply was modified 4 years, 10 months ago by quentin1995.