wp_privacy_generate_personal_data_export_group_html

The timeline below displays how wordpress function wp_privacy_generate_personal_data_export_group_html has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 * @since 5.4.0 Added the `$group_id` and `$groups_count` parameters.
 *
 * @param array  $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @param string $group_id     The group identifier.
 * @param int    $groups_count The number of all groups
 * @return string The HTML for this group and its items.
 */
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;
}

WordPress Version: 5.6

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 * @since 5.4.0 Added the `$group_id` and `$groups_count` parameters.
 *
 * @param array  $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @param string $group_id     The group identifier.
 * @param int    $groups_count The number of all groups
 * @return string The HTML for this group and its items.
 */
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 (false === strpos($value, ' ') && (0 === strpos($value, 'http://') || 0 === strpos($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;
}

WordPress Version: 5.5

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 * @since 5.4.0 Added the `$group_id` and `$groups_count` parameters.
 *
 * @param array  $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @param string $group_id     The group identifier.
 * @param int    $groups_count The number of all groups
 * @return string The HTML for this group and its items.
 */
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 (false === strpos($value, ' ') && (0 === strpos($value, 'http://') || 0 === strpos($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__('Return to top') . '</a>';
        $group_html .= '</div>';
    }
    $group_html .= '</div>';
    return $group_html;
}

WordPress Version: 5.4

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 * @since 5.4.0 Added the `$group_id` and `$groups_count` parameters.
 *
 * @param array $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @param string  $group_id     The group identifier.
 * @param int     $groups_count The number of all groups
 * @return string $group_html   The HTML for this group and its items.
 */
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 (false === strpos($value, ' ') && (0 === strpos($value, 'http://') || 0 === strpos($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 (1 < $groups_count) {
        $group_html .= '<div class="return_to_top">';
        $group_html .= '<a href="#top">' . esc_html__('&uarr; Return to top') . '</a>';
        $group_html .= '</div>';
    }
    $group_html .= '</div>';
    return $group_html;
}

WordPress Version: 5.3

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 *
 * @param array $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @return string The HTML for this group and its items.
 */
function wp_privacy_generate_personal_data_export_group_html($group_data)
{
    $group_html = '<h2>';
    $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 (false === strpos($value, ' ') && (0 === strpos($value, 'http://') || 0 === strpos($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>';
    }
    $group_html .= '</div>';
    return $group_html;
}

WordPress Version: 5.2

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 *
 * @param array $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @return string The HTML for this group and its items.
 */
function wp_privacy_generate_personal_data_export_group_html($group_data)
{
    $group_html = '<h2>' . esc_html($group_data['group_label']) . '</h2>';
    $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 (false === strpos($value, ' ') && (0 === strpos($value, 'http://') || 0 === strpos($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>';
    }
    $group_html .= '</div>';
    return $group_html;
}

WordPress Version: 9.7

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 *
 * @param array $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @return string The HTML for this group and its items.
 */
function wp_privacy_generate_personal_data_export_group_html($group_data)
{
    $allowed_tags = array('a' => array('href' => array(), 'target' => array()), 'br' => array());
    $allowed_protocols = array('http', 'https');
    $group_html = '';
    $group_html .= '<h2>' . esc_html($group_data['group_label']) . '</h2>';
    $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 (false === strpos($value, ' ') && (0 === strpos($value, 'http://') || 0 === strpos($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, $allowed_tags, $allowed_protocols) . '</td>';
            $group_html .= '</tr>';
        }
        $group_html .= '</tbody>';
        $group_html .= '</table>';
    }
    $group_html .= '</div>';
    return $group_html;
}

WordPress Version: 9.6

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 *
 * @param array  $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @return string The HTML for this group and its items.
 */
function wp_privacy_generate_personal_data_export_group_html($group_data)
{
    $allowed_tags = array('a' => array('href' => array(), 'target' => array()), 'br' => array());
    $allowed_protocols = array('http', 'https');
    $group_html = '';
    $group_html .= '<h2>' . esc_html($group_data['group_label']) . '</h2>';
    $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 (false === strpos($value, ' ') && (0 === strpos($value, 'http://') || 0 === strpos($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, $allowed_tags, $allowed_protocols) . '</td>';
            $group_html .= '</tr>';
        }
        $group_html .= '</tbody>';
        $group_html .= '</table>';
    }
    $group_html .= '</div>';
    return $group_html;
}

WordPress Version: .10

/**
 * Generate a single group for the personal data export report.
 *
 * @since 4.9.6
 *
 * @param array $group_data {
 *     The group data to render.
 *
 *     @type string $group_label  The user-facing heading for the group, e.g. 'Comments'.
 *     @type array  $items        {
 *         An array of group items.
 *
 *         @type array  $group_item_data  {
 *             An array of name-value pairs for the item.
 *
 *             @type string $name   The user-facing name of an item name-value pair, e.g. 'IP Address'.
 *             @type string $value  The user-facing value of an item data pair, e.g. '50.60.70.0'.
 *         }
 *     }
 * }
 * @return string The HTML for this group and its items.
 */
function wp_privacy_generate_personal_data_export_group_html($group_data)
{
    $allowed_tags = array('a' => array('href' => array(), 'target' => array()), 'br' => array());
    $allowed_protocols = array('http', 'https');
    $group_html = '';
    $group_html .= '<h2>' . esc_html($group_data['group_label']) . '</h2>';
    $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 (false === strpos($value, ' ') && (0 === strpos($value, 'http://') || 0 === strpos($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, $allowed_tags, $allowed_protocols) . '</td>';
            $group_html .= '</tr>';
        }
        $group_html .= '</tbody>';
        $group_html .= '</table>';
    }
    $group_html .= '</div>';
    return $group_html;
}