wp_privacy_process_personal_data_erasure_page

函数
wp_privacy_process_personal_data_erasure_page ( $response, $eraser_index, $email_address, $page, $request_id )
参数
  • (array) $response The response from the personal data eraser for the given page.
    Required:
  • (int) $eraser_index The index of the personal data eraser. Begins at 1.
    Required:
  • (string) $email_address The email address of the user whose personal data this is.
    Required:
  • (int) $page The page of personal data for this eraser. Begins at 1.
    Required:
  • (int) $request_id The request ID for this personal data erasure.
    Required:
返回值
  • (array) The filtered response.
相关
定义位置
相关方法
wp_privacy_process_personal_data_export_pagewp_comments_personal_data_eraserwp_privacy_send_personal_data_export_emailwp_privacy_generate_personal_data_export_filewp_ajax_wp_privacy_erase_personal_data
引入
4.9.6
弃用
-

wp_privacy_process_personal_data_erasure_page: 这个函数处理来自用户的个人数据删除请求。它从WordPress网站上删除所有与该用户相关的个人数据。

在处理结束后将清除请求标记为完成。

这拦截了对个人数据清除页面请求的Ajax响应,并监控请求的状态。一旦所有的处理完成,该请求就被标记为完成。

function wp_privacy_process_personal_data_erasure_page( $response, $eraser_index, $email_address, $page, $request_id ) {
	/*
	 * If the eraser response is malformed, don't attempt to consume it; let it
	 * pass through, so that the default Ajax processing will generate a warning
	 * to the user.
	 */
	if ( ! is_array( $response ) ) {
		return $response;
	}

	if ( ! array_key_exists( 'done', $response ) ) {
		return $response;
	}

	if ( ! array_key_exists( 'items_removed', $response ) ) {
		return $response;
	}

	if ( ! array_key_exists( 'items_retained', $response ) ) {
		return $response;
	}

	if ( ! array_key_exists( 'messages', $response ) ) {
		return $response;
	}

	// Get the request.
	$request = wp_get_user_request( $request_id );

	if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
		wp_send_json_error( __( 'Invalid request ID when processing personal data to erase.' ) );
	}

	/** This filter is documented in wp-admin/includes/ajax-actions.php */
	$erasers        = apply_filters( 'wp_privacy_personal_data_erasers', array() );
	$is_last_eraser = count( $erasers ) === $eraser_index;
	$eraser_done    = $response['done'];

	if ( ! $is_last_eraser || ! $eraser_done ) {
		return $response;
	}

	_wp_privacy_completed_request( $request_id );

	/**
	 * Fires immediately after a personal data erasure request has been marked completed.
	 *
	 * @since 4.9.6
	 *
	 * @param int $request_id The privacy request post ID associated with this request.
	 */
	do_action( 'wp_privacy_personal_data_erased', $request_id );

	return $response;
}

常见问题

FAQs
查看更多 >