wp_set_option_autoload

函式
wp_set_option_autoload ( $option, $autoload )
引數
  • (string) $option Name of the option. Expected to not be SQL-escaped.
    Required:
  • (string|bool) $autoload Autoload value to control whether to load the option when WordPress starts up. Accepts 'yes'|true to enable or 'no'|false to disable.
    Required:
返回值
  • (bool) True if the autoload value was modified, false otherwise.
相關
  • wp_set_option_autoload_values()
定義位置
相關方法
wp_set_options_autoloadwp_set_option_autoload_valuesis_user_option_localwp_get_post_autosavewp_set_post_lock
引入
6.4.0
棄用
-

設定資料庫中某個選項的自動載入值。這是 {@see} 的包裝器,可用於同時設定多個選項的自動載入值。

function wp_set_option_autoload( $option, $autoload ) {
	$result = wp_set_option_autoload_values( array( $option => $autoload ) );
	if ( isset( $result[ $option ] ) ) {
		return $result[ $option ];
	}
	return false;
}

常見問題

FAQs
檢視更多 >