Automattic\WooCommerce\Internal\Admin

WCAdminUser::register_user_data()publicWC 1.0

Registers WooCommerce specific user data to the WordPress user API.

Метод класса: WCAdminUser{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WCAdminUser = new WCAdminUser();
$WCAdminUser->register_user_data();

Код WCAdminUser::register_user_data() WC 8.9.0

public function register_user_data() {
	register_rest_field(
		'user',
		'is_super_admin',
		array(
			'get_callback' => function( $user ) {
				if ( ! isset( $user['id'] ) || 0 === $user['id'] ) {
					return false;
				}

				return is_super_admin( $user['id'] );
			},
			'schema'       => null,
		)
	);
	register_rest_field(
		'user',
		'woocommerce_meta',
		array(
			'get_callback'    => array( $this, 'get_user_data_values' ),
			'update_callback' => array( $this, 'update_user_data_values' ),
			'schema'          => null,
		)
	);
}