I've looked at many WP development forums but I couldn't find any answer, unfortunately. If anybody can help me. Actually, I am not sure if that kind of problem can be solved with WordPress at all.

My problem is the following.

When creating a new user in WordPress admin, the admin is offered a screen like the photo I am attaching here.

Adding a new user to WordPress Admin

After the user has already been created, the admin is redirected back to the page containing all the users.

My problem is, how can I add some additional tests on the user that is being created. The question is related to development of a WP plugin, php, which action hooks I can use for that purpose. I want to stay on the same page (my_domain/wp-admin/user-new.php) but after I push the 'Add New User' button, I want only the content of that page to change, the rest (I mean the admin menu on the left side to stay there) but only the content (the right area) to change (here I want to make my additional tests on that user), and showing a 'Next' button at bottom.

I've been thinking about adding some parameters in the URL but I do not know how to insert my code so that my problem can be solved. I may be wrong, that was the only thing that came into my mind. Is that possible to be implemented in WP at all? I know how to develop the pages, the only thing I cannot do is how to switch the right content but still stay on the same (add-new user-page). All the lectures I've been watching on WP plugin development, theme development, solve some not so complex problems - creating new content types, adding new menu/submenu items, and the pages related to these items, ajax and so on.

Could you please give me some directions(code snippets, hooks I can use), some code examples maybe, I say again, if that problem can be solved in WP at all.

Thank you in advance. Best regards, George!

  • I would have a look in wp-includes/user.php there's a few functions called one of the action hooks I can see is do_action( 'user_register', $user_id ); on around line 2000. – Bysander Oct 10 '16 at 13:29

I'd think you'd need to hook into the user_register action, like recommended above, and then use some code similar to this:

function post_user_reg_redirect( $user_id )
        if ( is_admin() ) {
             wp_redirect(get_edit_user_link( $user_id ));


This would check that you're creating a user in the admin view, and then redirect to the edit user link of that newly-created user.

  • Curious if the above solution worked out for you -- Did some testing on my end and seemed to fire on the user creation properly. Thanks! – Greg Burkett Oct 11 '16 at 18:13

Thanks to Greg for the code snippet. These lines were the key:

wp_redirect(get_edit_user_link( $user_id ));
die();   // Especially this one

What I did in my plugin (the 'user_register' action hook) was this:

wp_redirect( add_query_arg( array('user_id' => $ID, 'step' => '2')) );

This way the URL after the admin has been created the user looks like this: domain/wp-admin/user-new.php?user_id=33&step=2

and the admin is redirected to the same user page, as I wanted to.

In my plugin I also enqueue a js file using the 'admin_enqueue_scripts' action hook.

In that .js file I check the URL for the 'step' parameter, if it is available and equals to 2 then I replace the right side content (of the main wrapper 'wrap' of the right pane) loading the additional tests on that user(a player in my site) and finish the process using ajax in WP.

Probably it is not the perfect solution but it works.

If you could offer a better solution I will be glad to hear that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.