WordPress at Your Fingertips
function is not described

wc_get_post_data_by_key() WC 3.0.9

Get an item of post data if set, otherwise return a default value.

No Hooks.

Return

Mixed. Value sanitized by wc_clean.

Usage

wc_get_post_data_by_key( $key, $default );
$key(string) (required)
Meta key.
$default(string)
Default value.
Default: ''

Changelog

Since 3.0.9 Introduced.

Code of wc_get_post_data_by_key() WC 5.8.0

function wc_get_post_data_by_key( $key, $default = '' ) {
	// phpcs:ignore WordPress.Security.ValidatedSanitizedInput, WordPress.Security.NonceVerification.Missing
	return wc_clean( wp_unslash( wc_get_var( $_POST[ $key ], $default ) ) );
}