fbpx

New wp_get_environment_type() function in WordPress 5.5

GET UP TO $500K IN BUSINESS FUNDING

WordPress 5.5 introduces a new wp_get_environment_type() function that retrieves a site’s current environment type. This allows plugin and theme authors to more easily differentiate how they handle specific functionality between production and development sites in a standardized way.

By default, this function will return production. Other values supported by default are development and staging.

Below is an example of how this new function can be used to determine a site’s environment type.

switch ( wp_get_environment_type() ) { case ‘development’: do_nothing(); break; case ‘staging’: do_staging_thing(); break; default: do_production_thing(); break; }

Of course care should be taken with this kind

BUILD A WEBSITE: RESOURCES

Pin It on Pinterest

Share This
Xiphos Web Marketing

FREE
VIEW