WP_ENVIRONMENT_TYPE Support

As described in the official Kinsta Blog I would expect the wp_get_environment_type() method to return development on DevKinsta websites.

A workaround is just defining define( 'WP_ENVIRONMENT_TYPE', 'development' ); within the wp-config.php file, but I would expect it similar to the Kinsta production and staging environments to be set automatically as this is easily forgot.

Q: DevKinsta Version
A: Version 1.0.2 (1.0.2.1256)

Q: OS Version
A: macOS 10.15.6

Q: Docker Desktop Version
A: 3.1.0

Welcome to DevKinsta @jaschaio . wp_get_environment_type defaults to production so it makes sense that it would show that. Great idea to get this added though. I’ve moved this over to feature requests for our developer’s to take a look at. Thanks for the suggestion!

1 Like

Hey,
Just wanted to drop in and say that if you “depend” (I would argue that you shouldn’t) on wp_get_environment_type() and WP_ENVIRONMENT_TYPE you can work around it until DevKinsta is able to set it for you, if they will :slight_smile:

  1. Enter the DevKinsta docker container and edit the fpm configuration:
    $ docker exec -it devkinsta_fpm bash
    $ cd /etc/php/7.4/fpm/pool.d
    $ nano www.conf
    
  2. Append the following line in the end of www.conf:
    env[WP_ENVIRONMENT_TYPE] = local
    
  3. Restart the container with docker restart devkinsta_fpm

Note that I had to install nano before I could get this working: docker exec devkinsta_fpm bash -c "apt-get update;apt-get -y install nano"