roles ) : array(); if ( empty( $roles ) ) { return static function (): void {}; } $filter = static function ( $allowed ) use ( $roles ) { return array_values( array_unique( array_merge( (array) $allowed, $roles ) ) ); }; add_filter( 'woocommerce_shop_manager_editable_roles', $filter ); return static function () use ( $filter ): void { remove_filter( 'woocommerce_shop_manager_editable_roles', $filter ); }; } /** * Build the staff account permission error. * * @return \WP_Error */ public static function denial(): \WP_Error { return new \WP_Error( 'woocommerce_pos_rest_cannot_edit_staff_account', __( 'Only an administrator can edit or delete a staff account from the POS.', 'woocommerce-pos' ), array( 'status' => rest_authorization_required_code() ) ); } }