Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/maybe add existing user to blog

This page is marked as incomplete. You can help Codex by expanding it.


Add a new user to a blog by visiting /newbloguser/username/.

This will only work when the user's details are saved as an option keyed as 'new_user_x', where 'x' is the username of the user to be added, as when a user is invited through the regular WP Add User interface.

The details must at least contain values for the following keys:

  • $details['user_id'] - (integer) the ID of the user being added to the blog
  • $details['role'] - (string) the role to be assigned to the user in the blog


<?php maybe_add_existing_user_to_blog(); ?>


This function does not accept parameters, pertinent information is passed by saving it in the options as described in Description. This information is then removed from options once the data has been extracted.

Return Value

This function does not return. Rather, the thread is terminated with wp_die(), displaying a message indicating success or failure.



Change Log

Since: MU

Source File

maybe_add_existing_user_to_blog() is located in wp-includes/ms-functions.php



See also index of Function Reference and index of Template Tags.