钩子文档

get_user_option_{$option}

💡 云策文档标注

概述

这是一个动态过滤器钩子,用于在获取特定用户选项值时进行过滤。钩子名称中的动态部分 $option 对应要过滤的用户选项名。

关键要点

  • 钩子名称:get_user_option_{$option},其中 $option 是动态的用户选项名
  • 参数:$result(用户选项值)、$option(选项名)、$user(WP_User 对象)
  • 用途:允许开发者修改或拦截用户选项的返回值
  • 相关函数:get_user_option() 用于检索用户选项
  • 引入版本:WordPress 2.5.0

📄 原文内容

Filters a specific user option value.

Description

The dynamic portion of the hook name, $option, refers to the user option name.

Parameters

$resultmixed
Value for the user’s option.
$optionstring
Name of the option being retrieved.
$userWP_User
WP_User object of the user whose option is being retrieved.

Source

return apply_filters( "get_user_option_{$option}", $result, $option, $user );

Changelog

Version Description
2.5.0 Introduced.