Created
April 28, 2026 07:50
-
-
Save vapvarun/2969de4e737faa8055ec2900cc25ef9c to your computer and use it in GitHub Desktop.
WP_DEVELOPMENT_MODE: All 5 values with full wp-config.php examples (vapvarun.com)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // wp-config.php — Core development mode | |
| // Use this when you are working on WordPress core patches, | |
| // testing core REST API changes, or running Gutenberg block-editor experiments. | |
| define( 'WP_DEVELOPMENT_MODE', 'core' ); | |
| // Pair it with the full debug stack so you catch every notice | |
| define( 'WP_DEBUG', true ); | |
| define( 'WP_DEBUG_LOG', true ); // writes to wp-content/debug.log | |
| define( 'WP_DEBUG_DISPLAY', false ); // keep screen clean in local browser | |
| define( 'SCRIPT_DEBUG', true ); // load .dev.js / .dev.css source files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // wp-config.php — Plugin development mode | |
| // Use this when building or debugging a plugin. | |
| // WordPress skips object-cache for plugin assets and avoids | |
| // certain auto-minification behaviors that mask JS errors. | |
| define( 'WP_DEVELOPMENT_MODE', 'plugin' ); | |
| define( 'WP_DEBUG', true ); | |
| define( 'WP_DEBUG_LOG', true ); | |
| define( 'WP_DEBUG_DISPLAY', false ); | |
| define( 'SCRIPT_DEBUG', true ); | |
| // Useful companion constant: disables concatenation of admin scripts | |
| // so browser DevTools shows real file names, not a merged blob | |
| define( 'CONCATENATE_SCRIPTS', false ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // wp-config.php — Theme development mode | |
| // Use this when building custom themes or FSE block themes. | |
| // WordPress bypasses theme stylesheet caching so changes | |
| // appear without a hard refresh or cache-bust query string. | |
| define( 'WP_DEVELOPMENT_MODE', 'theme' ); | |
| define( 'WP_DEBUG', true ); | |
| define( 'WP_DEBUG_LOG', true ); | |
| define( 'WP_DEBUG_DISPLAY', false ); | |
| define( 'SCRIPT_DEBUG', true ); | |
| // Optional: disable the theme cache when using the WP REST API | |
| // so theme.json changes render immediately in the block editor | |
| define( 'WP_ENVIRONMENT_TYPE', 'development' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // wp-config.php — 'all' mode (core + plugin + theme combined) | |
| // Use when you are touching multiple layers at once — for example, | |
| // building a plugin that registers a block that ships with a child theme. | |
| // WordPress 6.4+ recognises 'all' as the catch-all development value. | |
| define( 'WP_DEVELOPMENT_MODE', 'all' ); | |
| define( 'WP_DEBUG', true ); | |
| define( 'WP_DEBUG_LOG', true ); | |
| define( 'WP_DEBUG_DISPLAY', false ); | |
| define( 'SCRIPT_DEBUG', true ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // wp-config.php — empty string '' (development mode OFF) | |
| // Setting WP_DEVELOPMENT_MODE to an empty string is the CORRECT way | |
| // to explicitly disable development mode on staging or production. | |
| // Do NOT simply omit the constant — third-party code may define it. | |
| // An explicit empty string guarantees it is off. | |
| define( 'WP_DEVELOPMENT_MODE', '' ); | |
| // On production, also ensure debug is off: | |
| define( 'WP_DEBUG', false ); | |
| define( 'WP_DEBUG_LOG', false ); | |
| define( 'WP_DEBUG_DISPLAY', false ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // wp-config.php — Environment-aware WP_DEVELOPMENT_MODE | |
| // Reads from a .env file or server environment variable. | |
| // Keeps wp-config.php identical across dev / staging / production. | |
| // Works well with Local by Flywheel, Kinsta, or WP Playground. | |
| $env = getenv( 'WP_ENV' ) ?: 'production'; | |
| switch ( $env ) { | |
| case 'development': | |
| define( 'WP_DEVELOPMENT_MODE', 'all' ); | |
| define( 'WP_DEBUG', true ); | |
| define( 'WP_DEBUG_LOG', true ); | |
| define( 'WP_DEBUG_DISPLAY', false ); | |
| define( 'SCRIPT_DEBUG', true ); | |
| break; | |
| case 'staging': | |
| // Staging mirrors production but keeps debug.log for QA review | |
| define( 'WP_DEVELOPMENT_MODE', '' ); | |
| define( 'WP_DEBUG', true ); | |
| define( 'WP_DEBUG_LOG', true ); | |
| define( 'WP_DEBUG_DISPLAY', false ); | |
| break; | |
| default: // production | |
| define( 'WP_DEVELOPMENT_MODE', '' ); | |
| define( 'WP_DEBUG', false ); | |
| define( 'WP_DEBUG_LOG', false ); | |
| define( 'WP_DEBUG_DISPLAY', false ); | |
| break; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // How to READ WP_DEVELOPMENT_MODE inside your plugin or theme | |
| // Use wp_get_development_mode() — introduced in WordPress 6.3. | |
| // Returns the current mode string: 'core', 'plugin', 'theme', 'all', or ''. | |
| function myplugin_register_dev_tools(): void { | |
| // Only load dev tools when in plugin development mode | |
| if ( 'plugin' === wp_get_development_mode() || 'all' === wp_get_development_mode() ) { | |
| require_once plugin_dir_path( __FILE__ ) . 'dev/debug-panel.php'; | |
| } | |
| } | |
| add_action( 'plugins_loaded', 'myplugin_register_dev_tools' ); | |
| // wp_is_development_mode( $mode ) checks a specific mode | |
| // Returns true when WP_DEVELOPMENT_MODE matches $mode OR equals 'all' | |
| function myplugin_enqueue_debug_assets(): void { | |
| if ( wp_is_development_mode( 'plugin' ) ) { | |
| wp_enqueue_style( | |
| 'myplugin-debug', | |
| plugin_dir_url( __FILE__ ) . 'assets/debug.css', | |
| [], | |
| filemtime( plugin_dir_path( __FILE__ ) . 'assets/debug.css' ) | |
| ); | |
| } | |
| } | |
| add_action( 'wp_enqueue_scripts', 'myplugin_enqueue_debug_assets' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Multisite — per-network WP_DEVELOPMENT_MODE via sunrise.php | |
| // wp-config.php on a multisite network sets WP_DEVELOPMENT_MODE globally. | |
| // To override per-subsite, use a sunrise.php mu-plugin. | |
| // In wp-config.php (before /* That's all... */): | |
| define( 'SUNRISE', true ); // enable sunrise.php | |
| define( 'WP_DEVELOPMENT_MODE', 'all' ); // default for all subsites | |
| // In wp-content/sunrise.php: | |
| // Override for a specific subsite by blog_id | |
| if ( isset( $current_blog ) && 5 === (int) $current_blog->blog_id ) { | |
| // Subsite 5 is the staging preview — keep dev mode off there | |
| if ( ! defined( 'WP_DEVELOPMENT_MODE' ) ) { | |
| define( 'WP_DEVELOPMENT_MODE', '' ); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://playground.wordpress.net/blueprint-schema.json", | |
| "phpVersion": "8.2", | |
| "wordPressVersion": "latest", | |
| "steps": [ | |
| { | |
| "step": "defineWpConfigConsts", | |
| "consts": { | |
| "WP_DEVELOPMENT_MODE": "plugin", | |
| "WP_DEBUG": true, | |
| "WP_DEBUG_LOG": true, | |
| "WP_DEBUG_DISPLAY": false, | |
| "SCRIPT_DEBUG": true | |
| } | |
| }, | |
| { | |
| "step": "installPlugin", | |
| "pluginZipFile": { | |
| "resource": "url", | |
| "url": "https://github.com/vapvarun/my-plugin/archive/refs/heads/main.zip" | |
| }, | |
| "options": { "activate": true } | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment