wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_get_development_mode › WordPress Function

Since6.3.0
Deprecatedn/a
wp_get_development_mode ( No parameters )
Returns:
  • (string) The current development mode.
Defined at:
Codex:

Retrieves the current development mode.

The development mode affects how certain parts of the WordPress application behave, which is relevant when developing for WordPress. Development mode can be set via the WP_DEVELOPMENT_MODE constant in wp-config.php. Possible values are 'core', 'plugin', 'theme', 'all', or an empty string to disable development mode. 'all' is a special value to signify that all three development modes ('core', 'plugin', and 'theme') are enabled. Development mode is considered separately from WP_DEBUG and wp_get_environment_type(). It does not affect debugging output, but rather functional nuances in WordPress. This function retrieves the currently set development mode value. To check whether a specific development mode is enabled, use wp_is_development_mode().


Source

function wp_get_development_mode() {
	static $current_mode = null;

	if ( ! defined( 'WP_RUN_CORE_TESTS' ) && null !== $current_mode ) {
		return $current_mode;
	}

	$development_mode = WP_DEVELOPMENT_MODE;

	// Exclusively for core tests, rely on the `$_wp_tests_development_mode` global.
	if ( defined( 'WP_RUN_CORE_TESTS' ) && isset( $GLOBALS['_wp_tests_development_mode'] ) ) {
		$development_mode = $GLOBALS['_wp_tests_development_mode'];
	}

	$valid_modes = array(
		'core',
		'plugin',
		'theme',
		'all',
		'',
	);

	if ( ! in_array( $development_mode, $valid_modes, true ) ) {
		$development_mode = '';
	}

	$current_mode = $development_mode;

	return $current_mode;
}