wp_privacy_anonymize_data()WP 4.9.6

Returns uniform "anonymous" data by type.

Хуки из функции

Возвращает

Строку. The anonymous data for the requested type.

Использование

wp_privacy_anonymize_data( $type, $data );
$type(строка) (обязательный)
The type of data to be anonymized.
$data(строка)
The data to be anonymized.
По умолчанию: empty string

Список изменений

С версии 4.9.6 Введена.

Код wp_privacy_anonymize_data() WP 6.6.2

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 = '';
			break;
	}

	/**
	 * Filters the anonymous data for each type.
	 *
	 * @since 4.9.6
	 *
	 * @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 );
}