WP_User::remove_all_caps() WordPress Method

The WP_User::remove_all_caps() function removes all capabilities from a user. This is useful when you want to reset a user's capabilities to the default.

WP_User::remove_all_caps() #

Removes all of the capabilities of the user.


Source

File: wp-includes/class-wp-user.php

	public function remove_all_caps() {
		global $wpdb;
		$this->caps = array();
		delete_user_meta( $this->ID, $this->cap_key );
		delete_user_meta( $this->ID, $wpdb->get_blog_prefix() . 'user_level' );
		$this->get_role_caps();
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.