WC_Privacy::anonymize_custom_data_types()
Handle some custom types of data and anonymize them.
Method of the class: WC_Privacy{}
No Hooks.
Return
String
. Anonymized string.
Usage
$WC_Privacy = new WC_Privacy(); $WC_Privacy->anonymize_custom_data_types( $anonymous, $type, $data );
- $anonymous(string) (required)
- Anonymized string.
- $type(string) (required)
- Type of data.
- $data(string) (required)
- The data being anonymized.
WC_Privacy::anonymize_custom_data_types() WC Privacy::anonymize custom data types code WC 9.4.2
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; }