钩子文档

wp_privacy_additional_user_profile_data

💡 云策文档标注

概述

wp_privacy_additional_user_profile_data 是一个 WordPress 过滤器,用于在隐私数据导出器中添加或修改用户的额外个人资料数据。它允许开发者自定义导出数据项,如 IP 地址等。

关键要点

  • 这是一个过滤器,用于扩展用户隐私数据导出功能。
  • 参数包括 $additional_user_profile_data(数组,默认空)、$user(WP_User 对象)和 $reserved_names(字符串数组)。
  • 可以添加 name-value 对,例如 name 为 'IP Address',value 为 '50.60.70.0'。
  • 如果数据项名称在 $reserved_names 中,则不会被包含在导出中。
  • 从 WordPress 5.4.0 版本开始引入。

代码示例

$_extra_data = apply_filters( 'wp_privacy_additional_user_profile_data', array(), $user, $reserved_names );

📄 原文内容

Filters the user’s profile data for the privacy exporter.

Parameters

$additional_user_profile_dataarray
An array of name-value pairs of additional user data items. Default empty array.

  • 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'.

$userWP_User
The user whose data is being exported.
$reserved_namesstring[]
An array of reserved names. Any item in $additional_user_data that uses one of these for its name will not be included in the export.

Source

$_extra_data = apply_filters( 'wp_privacy_additional_user_profile_data', array(), $user, $reserved_names );

Changelog

Version Description
5.4.0 Introduced.