WC_Install::remove_roles()public staticWC 1.0

Remove WooCommerce roles.

Method of the class: WC_Install{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Install::remove_roles();

WC_Install::remove_roles() code WC 9.4.2

public static function remove_roles() {
	global $wp_roles;

	if ( ! class_exists( 'WP_Roles' ) ) {
		return;
	}

	if ( ! isset( $wp_roles ) ) {
		$wp_roles = new WP_Roles(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
	}

	$capabilities = self::get_core_capabilities();

	foreach ( $capabilities as $cap_group ) {
		foreach ( $cap_group as $cap ) {
			$wp_roles->remove_cap( 'shop_manager', $cap );
			$wp_roles->remove_cap( 'administrator', $cap );
		}
	}

	remove_role( 'customer' );
	remove_role( 'shop_manager' );
}