[wp-trac] [WordPress Trac] #50896: Add filters to wp_get_environment_type()

WordPress Trac noreply at wordpress.org
Fri Aug 14 01:03:38 UTC 2020


#50896: Add filters to wp_get_environment_type()
----------------------------+------------------------------
 Reporter:  crstauf         |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Bootstrap/Load  |     Version:  5.5
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------------------

Comment (by TimothyBlynJacobs):

 > And as I mentioned previously, if an mu-plugin is using
 wp_get_environment_type() prior to muplugins_loaded action, I assign that
 responsibility to the site's developer to resolve.

 I disagree with this for a couple of reasons.

 1. You also need to consider drop-ins that can make use of that value.
 2. Network activated plugins are loaded before `muplugins_loaded` is fired
 which means plugins in general can't rely on it on multisite.
 3. Mu-plugins are often the way that hosting companies provide
 functionality specific to their host. They wouldn't be able to rely on
 this value either then.
 4. Mu-plugins aren't just used by highly customized sites with developers
 where they know how each and every one of them work under the hood.
 Plugins can make use of mu-plugins as well when they need to be loaded
 early.

 Additionally, while debug mode is the only place Core is currently using
 the environment early in the load process, that isn't guaranteed into the
 future. If Core can't rely on that value being constant throughout the
 request that would hamper future development opportunities.

 Lastly, I don't think distributing and mandating an mu-plugin be installed
 on dev sites is any easier than mandating that a value be set in `wp-
 config.php`. Both are susceptible to user error. For this type of site, I
 think you'd be better off tracking the whole thing in git and having a
 `wp-config-partial.php` that defines the environment type by default. Or
 mandating use of a development environment that would populate
 `WP_ENVIRONMENT_TYPE`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50896#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list