Personal Data Exporter

Read more about the Personal Data Exporter in the Plugin Handbook.

The Personal Data Exporter provides a downloadable copy of a user’s personally identifiable data based on a provided email address. WordPress also provides the workflow for requesting, generating, and delivering the download, which leaves the plugin developer with the specifics for their collected data.

Register a New Exporter

add_filter( ‘wp_privacy_personal_data_exporters’, function( $exporters ){
    $exporters[ ‘my-plugin’ ] = [
        ‘exporter_friendly_name’ => __( ‘My Plugin’ ),
        ‘callback’ => ‘my_plugin_exporter’,
    ];
    return $exporters;
}, 10 );

Exporting Plugin Data

function my_plugin_exporter( $email_address, $page = 1 ) {
    $exported_items = [
        ‘group_id’ => ‘comments’,
        ‘group_label’ => __( ‘Comments’ ),
        ‘item_id’ => ‘comment-1’,
        ‘data’ => [
            [
                ‘name’ => __( ‘Item 1 Data’ ),
                ‘value’ => ‘data-goes-here’
            ]
        ];
    ];       
    return [
        ‘data’ => $export_items,
        ‘done’ => $done,
    ];
}

Data Format

Each “item” of data is an array with “name” and “value” key/value pairs.