A WordPress-centric search engine for devs and theme authors



wp_privacy_anonymize_data ›

Since5.0.0
Deprecatedn/a
wp_privacy_anonymize_data ( $type, $data = '' )
Parameters: (2)
  • (string) $type The type of data to be anonymized.
    Required: Yes
  • (string) $data Optional The data to be anonymized.
    Required: No
    Default: (empty)
Returns:
  • (string) The anonymous data for the requested type.
Defined at:
Codex:

Return uniform "anonymous" data by type.



Source

function wp_privacy_anonymize_data( $type, $data = '' ) {

	switch ( $type ) {
		case 'email':
			$anonymous = 'deleted@site.invalid';
			break;
		case 'url':
			$anonymous = 'https://site.invalid';
			break;
		case 'ip':
			$anonymous = wp_privacy_anonymize_ip( $data );
			break;
		case 'date':
			$anonymous = '0000-00-00 00:00:00';
			break;
		case 'text':
			/* translators: deleted text */
			$anonymous = __( '[deleted]' );
			break;
		case 'longtext':
			/* translators: deleted long text */
			$anonymous = __( 'This content was deleted by the author.' );
			break;
		default:
			$anonymous = '';
	}

	/**
	 * Filters the anonymous data for each type.
	 *
	 * @since 5.0.0
	 *
	 * @param string $anonymous Anonymized data.
	 * @param string $type      Type of the data.
	 * @param string $data      Original data.
	 */
	return apply_filters( 'wp_privacy_anonymize_data', $anonymous, $type, $data );
}