wc_sanitize_coupon_code( string $value )

Sanitize a coupon code.


Description Description

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


Parameters Parameters

$value

(Required) Coupon code to format.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/wc-formatting-functions.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
3.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.