pre_site_option_{$option}

過濾鉤子
apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $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_network_option(). Default false (to skip past the short-circuit).
    Required:
  • (string) $option Option name.
    Required:
  • (int) $network_id ID of the network.
    Required:
  • (mixed) $default The fallback value to return if the option does not exist. Default false.
    Required:
定義位置
相關勾子
pre_add_site_option_optionsite_option_optionupdate_site_option_optionpre_update_option_optionpre_delete_site_option_option
相關方法
get_site_optionupdate_site_optionadd_site_optiondelete_site_optionwp_load_core_site_optionsscreen_options
引入
4.9.0
棄用
-

pre_site_option_{$option}: 該過濾器用於在get_site_option函式返回之前過濾全站選項的值。這允許開發者在網站使用前修改全站選項的值。過濾器的名稱是動態的,$option佔位符被替換為被檢索的選項的名稱。

在檢索現有網路選項的值之前過濾該值。

鉤子名稱的動態部分$option引用了選項名稱。

從過濾器中返回非false的值將使檢索短路,並返回該值。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $default );
$pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $default );
$pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $default );

常見問題

FAQs
檢視更多 >