WordPress at a glance

update_user_status() WP 1.0

Deprecated from version 5.3.0. It is no longer supported and can be removed in future releases. Use wp_update_user() instead.

Update the status of a user in the database.

Previously used in core to mark a user as spam or "ham" (not spam) in Multisite.

Hooks from the function

Int. The initially passed $value.


update_user_status( $id, $pref, $value, $deprecated );
$id(int) (required)
The user ID.
$pref(string) (required)
The column in the wp_users table to update the user's status in (presumably user_status, spam, or deleted).
$value(int) (required)
The new status for the user.
Deprecated as of 3.0.2 and should not be used.


  • See: wp_update_user()
  • Global. wpdb. $wpdb WordPress database abstraction object.


Since 3.0.0 Introduced.
Deprecated Since 5.3.0 Use wp_update_user()

Code of update_user_status() WP 5.7.2

function update_user_status( $id, $pref, $value, $deprecated = null ) {
	global $wpdb;

	_deprecated_function( __FUNCTION__, '5.3.0', 'wp_update_user()' );

	if ( null !== $deprecated ) {
		_deprecated_argument( __FUNCTION__, '3.0.2' );

	$wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) );

	$user = new WP_User( $id );
	clean_user_cache( $user );

	if ( 'spam' === $pref ) {
		if ( $value == 1 ) {
			/** This filter is documented in wp-includes/user.php */
			do_action( 'make_spam_user', $id );
		} else {
			/** This filter is documented in wp-includes/user.php */
			do_action( 'make_ham_user', $id );

	return $value;

From tag: statuses (of post comment user)

More from tag: Users (_user)

More from category: Multisite

No comments
    Log In