# wp_privacy_generate_personal_data_export_group_html()

URL: https://chugunov.pro/api-wordpress/functions/wp_privacy_generate_personal_data_export_group_html/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 4.9.6.

## Сигнатура

```php
wp_privacy_generate_personal_data_export_group_html( array $group_data, string $group_id = '', int $groups_count = 1 ): string
```

## Описание

Формирует отдельную группу для отчёта экспорта персональных данных.

## Параметры

- `$group_data` `array` — обязательный. The group data to render.
  
  - `group_label` string The user-facing heading for the group, e.g. `'Comments'`.
  
  - `items` array An array of group items.
  
  - `group_item_data` array An array of name-value pairs for the item.
  
  - `name` string The user-facing name of an item name-value pair, e.g. ‘IP Address’.
  
  - `value` string The user-facing value of an item data pair, e.g. `'50.60.70.0'`.
  
  }
  
  `$group_id`string optional The group identifier. Default:`''``$groups_count`int optional The number of all groups Default:`1`
  [Return](#return) string The HTML for this group and its items.
  
  [Source](#source)
  
  ```
  function wp_privacy_generate_personal_data_export_group_html( $group_data, $group_id = '', $groups_count = 1 ) {
  $group_id_attr = sanitize_title_with_dashes( $group_data['group_label'] . '-' . $group_id );
  
  $group_html = '';
  $group_html .= esc_html( $group_data['group_label'] );
  
  $items_count = count( (array) $group_data['items'] );
  if ( $items_count > 1 ) {
  $group_html .= sprintf( ' (%d) ', $items_count );
  }
  
  $group_html .= '
  ';
  
  if ( ! empty( $group_data['group_description'] ) ) {
  $group_html .= '' . esc_html( $group_data['group_description'] ) . '';
  }
  
  $group_html .= '';
  
  foreach ( (array) $group_data['items'] as $group_item_id => $group_item_data ) {
  $group_html .= '';
  $group_html .= '';
  
  foreach ( (array) $group_item_data as $group_item_datum ) {
  $value = $group_item_datum['value'];
  // If it looks like a link, make it a link.
  if ( ! str_contains( $value, ' ' ) && ( str_starts_with( $value, 'http://' ) || str_starts_with( $value, 'https://' ) ) ) {
  $value = '' . esc_html( $value ) . '';
  }
  
  $group_html .= '';
  $group_html .= '' . esc_html( $group_item_datum['name'] ) . ' | ';
  $group_html .= '' . wp_kses( $value, 'personal_data_export' ) . ' | ';
  $group_html .= '
  ';
  }
  
  $group_html .= '';
  $group_html .= '';
  }
  
  if ( $groups_count > 1 ) {
  $group_html .= '';
  $group_html .= '[↑ ' . esc_html__( 'Go to top' ) . '](#top)';
  $group_html .= '
  ';
  }
  
  $group_html .= '
  ';
  
  return $group_html;
  }
  ```
  
  [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/) [View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-admin/includes/privacy-tools.php#L252) [View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/privacy-tools.php#L252-L301)
  
  [Related](#related) Uses | Description |
  [esc_html__()](https://developer.wordpress.org/reference/functions/esc_html__/)`wp-includes/l10n.php` | Retrieves the translation of $text and escapes it for safe use in HTML output.
  |
  [sanitize_title_with_dashes()](https://developer.wordpress.org/reference/functions/sanitize_title_with_dashes/)`wp-includes/formatting.php` | Sanitizes a title, replacing whitespace and a few other characters with dashes.
  |
  [wp_kses()](https://developer.wordpress.org/reference/functions/wp_kses/)`wp-includes/kses.php` | Filters text content and strips out disallowed HTML.
  |
  [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` | Escaping for HTML attributes.
  |
  [esc_html()](https://developer.wordpress.org/reference/functions/esc_html/)`wp-includes/formatting.php` | Escaping for HTML blocks.
  |
  [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` | Checks and cleans a URL.
  |
  [Show 3 more](#)[Show less](#) Used by | Description |
  [wp_privacy_generate_personal_data_export_file()](https://developer.wordpress.org/reference/functions/wp_privacy_generate_personal_data_export_file/)`wp-admin/includes/privacy-tools.php` | Generate the personal data export file.
  |
  
  [Changelog](#changelog) Version | Description |
  [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Added the `$group_id` and `$groups_count` parameters. |
  [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
  
  User Contributed Notes You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_privacy_generate_personal_data_export_group_html%2F) before being able to contribute a note or feedback.

## Возвращаемое значение

`string`

## Исходный код

Файл: `wp-admin/includes/privacy-tools.php:252`

```php
function wp_privacy_generate_personal_data_export_group_html( $group_data, $group_id = '', $groups_count = 1 ) {
	$group_id_attr = sanitize_title_with_dashes( $group_data['group_label'] . '-' . $group_id );

	$group_html  = '<h2 id="' . esc_attr( $group_id_attr ) . '">';
	$group_html .= esc_html( $group_data['group_label'] );

	$items_count = count( (array) $group_data['items'] );
	if ( $items_count > 1 ) {
		$group_html .= sprintf( ' <span class="count">(%d)</span>', $items_count );
	}

	$group_html .= '</h2>';

	if ( ! empty( $group_data['group_description'] ) ) {
		$group_html .= '<p>' . esc_html( $group_data['group_description'] ) . '</p>';
	}

	$group_html .= '<div>';

	foreach ( (array) $group_data['items'] as $group_item_id => $group_item_data ) {
		$group_html .= '<table>';
		$group_html .= '<tbody>';

		foreach ( (array) $group_item_data as $group_item_datum ) {
			$value = $group_item_datum['value'];
			// If it looks like a link, make it a link.
			if ( ! str_contains( $value, ' ' ) && ( str_starts_with( $value, 'http://' ) || str_starts_with( $value, 'https://' ) ) ) {
				$value = '<a href="' . esc_url( $value ) . '">' . esc_html( $value ) . '</a>';
			}

			$group_html .= '<tr>';
			$group_html .= '<th>' . esc_html( $group_item_datum['name'] ) . '</th>';
			$group_html .= '<td>' . wp_kses( $value, 'personal_data_export' ) . '</td>';
			$group_html .= '</tr>';
		}

		$group_html .= '</tbody>';
		$group_html .= '</table>';
	}

	if ( $groups_count > 1 ) {
		$group_html .= '<div class="return-to-top">';
		$group_html .= '<a href="#top"><span aria-hidden="true">&uarr; </span> ' . esc_html__( 'Go to top' ) . '</a>';
		$group_html .= '</div>';
	}

	$group_html .= '</div>';

	return $group_html;
}
```

## История изменений

- 5.4.0 — Added the $group_id and $groups_count parameters.
- 4.9.6 — Introduced.

## Связанные

Использует: [`esc_html__`](https://chugunov.pro/api-wordpress/functions/esc_html__/), [`sanitize_title_with_dashes`](https://chugunov.pro/api-wordpress/functions/sanitize_title_with_dashes/), [`wp_kses`](https://chugunov.pro/api-wordpress/functions/wp_kses/), [`esc_attr`](https://chugunov.pro/api-wordpress/functions/esc_attr/), [`esc_html`](https://chugunov.pro/api-wordpress/functions/esc_html/), [`esc_url`](https://chugunov.pro/api-wordpress/functions/esc_url/).
Используется в: [`wp_privacy_generate_personal_data_export_file`](https://chugunov.pro/api-wordpress/functions/wp_privacy_generate_personal_data_export_file/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_privacy_generate_personal_data_export_group_html/
