pre_option_{$option}

过滤钩子
apply_filters( "pre_option_{$option}", false, $option, $default )
参数
  • (mixed) $pre_option The value to return instead of the option value. This differs from `$default`, which is used as the fallback value in the event the option doesn't exist elsewhere in get_option(). Default false (to skip past the short-circuit).
    Required:
  • (string) $option Option name.
    Required:
  • (mixed) $default The fallback value to return if the option does not exist. Default false.
    Required:
定义位置
相关勾子
pre_site_option_optionupdate_option_optionoption_optionsite_option_optionpre_update_option_option
相关方法
screen_optionsupdate_optionget_optionadd_screen_optionremove_option_update_handlerwp_timezone_string
引入
4.9.0
弃用
-

pre_option_{$option} – 这个钩子在从选项数据库表中检索特定的选项值之前被调用,特定的选项名称被替换为”{$option}”。开发者可以使用这个钩子为特定的选项提供一个自定义的值,绕过数据库的查询。

在检索一个现有的选项之前对其进行过滤。

钩子名称的动态部分,$option,指的是选项名称。

从过滤器中返回一个非false的值将缩短检索时间,并返回该值。

$pre = apply_filters( "pre_option_{$option}", false, $option, $default );

常见问题

FAQs
查看更多 >
闪电伯伯

(工作日 10:00 - 18:30 为您服务)

2025-11-19 09:27:50

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: