wc_sanitize_coupon_code()WC 3.6.0

Sanitize a coupon code.

Uses sanitize_post_field since coupon codes are stored as post_titles - the sanitization and escaping must match.

No Hooks.

Return

String.

Usage

wc_sanitize_coupon_code( $value );
$value(string) (required)
Coupon code to format.

Changelog

Since 3.6.0 Introduced.

wc_sanitize_coupon_code() code WC 7.5.1

function wc_sanitize_coupon_code( $value ) {
	return wp_filter_kses( sanitize_post_field( 'post_title', $value, 0, 'db' ) );
}