pre_option

過濾鉤子
apply_filters( 'pre_option', $pre, $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 Name of the option.
    Required:
  • (mixed) $default The fallback value to return if the option does not exist. Default false.
    Required:
定義位置
相關勾子
update_optionpre_pingupdated_optionpre_update_optionadded_option
相關方法
get_optionupdate_optionform_optionscreen_optionsmu_optionsadd_option
引入
6.1.0
棄用
-

pre_option – 這個鉤子在從選項資料庫表中檢索一個值之前被呼叫。開發者可以使用這個鉤子為選項提供一個自定義的值,繞過資料庫的查詢。

在檢索之前過濾所有現有選項的值。

從過濾器中返回一個真值將有效地縮短檢索並返回傳遞的值。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$pre = apply_filters( 'pre_option', $pre, $option, $default );
$pre = apply_filters( 'pre_option', $pre, $option, $default );
$pre = apply_filters( 'pre_option', $pre, $option, $default );

常見問題

FAQs
檢視更多 >