WordPress at Your Fingertips
function is not described

WC_Admin_Attributes::get_posted_attribute() private WC 1.0

Get and sanitize posted attribute data.

{} It's a method of the class: WC_Admin_Attributes{}

No Hooks.

Return

Array.

Usage

$result = WC_Admin_Attributes::get_posted_attribute();

Code of WC_Admin_Attributes::get_posted_attribute() WC 5.8.0

private static function get_posted_attribute() {
	$attribute = array(
		'attribute_label'   => isset( $_POST['attribute_label'] ) ? wc_clean( wp_unslash( $_POST['attribute_label'] ) ) : '', // WPCS: input var ok, CSRF ok.
		'attribute_name'    => isset( $_POST['attribute_name'] ) ? wc_sanitize_taxonomy_name( wp_unslash( $_POST['attribute_name'] ) ) : '', // WPCS: input var ok, CSRF ok, sanitization ok.
		'attribute_type'    => isset( $_POST['attribute_type'] ) ? wc_clean( wp_unslash( $_POST['attribute_type'] ) ) : 'select', // WPCS: input var ok, CSRF ok.
		'attribute_orderby' => isset( $_POST['attribute_orderby'] ) ? wc_clean( wp_unslash( $_POST['attribute_orderby'] ) ) : '', // WPCS: input var ok, CSRF ok.
		'attribute_public'  => isset( $_POST['attribute_public'] ) ? 1 : 0, // WPCS: input var ok, CSRF ok.
	);

	if ( empty( $attribute['attribute_type'] ) ) {
		$attribute['attribute_type'] = 'select';
	}
	if ( empty( $attribute['attribute_label'] ) ) {
		$attribute['attribute_label'] = ucfirst( $attribute['attribute_name'] );
	}
	if ( empty( $attribute['attribute_name'] ) ) {
		$attribute['attribute_name'] = wc_sanitize_taxonomy_name( $attribute['attribute_label'] );
	}

	return $attribute;
}