wp_is_development_mode

函式
wp_is_development_mode ( $mode )
引數
  • (string) $mode Development mode to check for. Either 'core', 'plugin', 'theme', or 'all'.
    Required:
返回值
  • (bool) True if the given mode is covered by the current development mode, false otherwise.
定義位置
相關方法
wp_get_development_modewp_is_recovery_modewp_register_development_scriptswp_is_maintenance_modewp_is_file_mod_allowed
引入
6.3.0
棄用
-

檢查站點是否處於給定的開發模式。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_is_development_mode( $mode ) {
$current_mode = wp_get_development_mode();
if ( empty( $current_mode ) ) {
return false;
}
// Return true if the current mode encompasses all modes.
if ( 'all' === $current_mode ) {
return true;
}
// Return true if the current mode is the given mode.
return $mode === $current_mode;
}
function wp_is_development_mode( $mode ) { $current_mode = wp_get_development_mode(); if ( empty( $current_mode ) ) { return false; } // Return true if the current mode encompasses all modes. if ( 'all' === $current_mode ) { return true; } // Return true if the current mode is the given mode. return $mode === $current_mode; }
function wp_is_development_mode( $mode ) {
	$current_mode = wp_get_development_mode();
	if ( empty( $current_mode ) ) {
		return false;
	}

	// Return true if the current mode encompasses all modes.
	if ( 'all' === $current_mode ) {
		return true;
	}

	// Return true if the current mode is the given mode.
	return $mode === $current_mode;
}

常見問題

FAQs
檢視更多 >