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

Function Reference/update user status


Update the status of a user in the database. Used in core to mark a user as spam or "ham" (not spam) on multisite installs.


<?php update_user_status$id$pref$value ); ?>


(integer) (required) The ID of the user.
Default: None
(string) (required) The column in the wp_users table to update the user's status in (presumably user_status, spam or deleted).
Default: None
(integer) (required) The new status for the user.
Default: None
(null) (optional) This parameter is deprecated and should not be used.
Default: null

Returns Values

Returns the $value parameter.


Mark a User as Spam

Note: You can only do this on multisite installs!

$user_id = 394;

update_user_status( $user_id, 'spam', 1 );

Mark a User as Ham

$user_id = 394;

update_user_status( $user_id, 'spam', 0 );

Again, this will not work on single site installs.


Change Log

  • 3.0.2: The $refresh parameter was deprecated.
  • Since: 3.0.0

Source File

update_user_status() is located in wp-admin/includes/ms.php.


See also index of Function Reference and index of Template Tags.
This article is marked as in need of editing. You can help Codex by editing it.