wordpress icon indicating copy to clipboard operation
wordpress copied to clipboard

Consider adding `WP_DEVELOPMENT_MODE`

Open samikeijonen opened this issue 2 years ago • 2 comments

There has been some caching related changes in recent WP releases.

In short, when developing a site, theme.json and patterns are cached. This makes it annoying to develop since the changes are not seen right away.

When in DEV my suggestion is to add define( 'WP_DEVELOPMENT_MODE', 'all' );. Maybe in wp-config.php:

/**
 * For developers: show verbose debugging output if not in production.
 */
if ( 'production' === getenv('WP_ENV') ) {
  define('WP_DEBUG', false);
  define('WP_DEBUG_DISPLAY', false);
  define('WP_DEBUG_LOG', false);
  define('SCRIPT_DEBUG', false);
} else {
  define('WP_DEBUG', true);
  define('WP_DEBUG_DISPLAY', true);
  define('WP_DEBUG_LOG', '/data/log/php-error.log');
  define('SCRIPT_DEBUG', true);
  // Added in here.
  define('WP_DEVELOPMENT_MODE', 'all');
}

samikeijonen avatar Nov 17 '23 07:11 samikeijonen

Very good, makes perfect sense. wp-config.php is the correct place for this as we have that if statement already there checking the WP_ENV variable. This new addition would then affect staging environments as well, where caching is not desired either.

Would you mind creating a PR yourself?

pekkakortelainen avatar Nov 27 '23 08:11 pekkakortelainen

Sure, I can do PR next week.

samikeijonen avatar Dec 03 '23 15:12 samikeijonen