WC_Privacy::anonymize_custom_data_types( string $anonymous, string $type, string $data )

Handle some custom types of data and anonymize them.


Description Description


Parameters Parameters

$anonymous

(Required) Anonymized string.

$type

(Required) Type of data.

$data

(Required) The data being anonymized.


Top ↑

Return Return

(string) Anonymized string.


Top ↑

Source Source

File: includes/class-wc-privacy.php

	public function anonymize_custom_data_types( $anonymous, $type, $data ) {
		switch ( $type ) {
			case 'address_state':
			case 'address_country':
				$anonymous = ''; // Empty string - we don't want to store anything after removal.
				break;
			case 'phone':
				$anonymous = preg_replace( '/\d/u', '0', $data );
				break;
			case 'numeric_id':
				$anonymous = 0;
				break;
		}
		return $anonymous;
	}

Top ↑

User Contributed Notes User Contributed Notes

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