brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: WP_DEVELOPMENT_MODE theme stops WordPress caching theme.json while you work

WordPress
~/tips/tip-wordpress-development-mode-theme

define( 'WP_DEVELOPMENT_MODE', 'theme' );

Tells WordPress you are developing a theme so theme.json edits show up immediately.

Building a block theme and your theme.json change does nothing? WordPress caches parts of it. This constant tells it not to.

define( 'WP_DEVELOPMENT_MODE', 'theme' );

The constant arrived in WordPress 6.3 and takes four values: core, plugin, theme or all. Empty, the default, means the site is not used for development. With theme, WordPress skips its cache for theme.json data and global styles, so a change in the file shows up on the next page load. all covers the theme behaviour too.

One side effect in current versions: when WP_DEBUG is not defined in your config, setting a development mode turns it on. That’s handy on a local site, but worth knowing.

Site Health shows the value under Info > WordPress Constants, so you can see which mode a site is in without reading the config.

I’d keep it off production. The core team says so plainly in the announcement, and it makes sense: the caches it skips exist for speed, so every page load does more work. On staging, set WP_ENVIRONMENT_TYPE instead, which tells plugins what kind of site this is without changing caching.

Further reading: Configuring development mode in 6.3, wp_get_development_mode()

Going deeper: Guide: let git bisect find the commit that broke your code

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link