[wp-trac] [WordPress Trac] #50896: Add filters to wp_get_environment_type()
WordPress Trac
noreply at wordpress.org
Tue Aug 11 17:55:42 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: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
----------------------------+------------------------------
Changes (by SergeyBiryukov):
* component: General => Bootstrap/Load
Old description:
> When first introduced and described on
> [https://make.wordpress.org/core/2020/07/24/new-wp_get_environment_type-
> function-in-wordpress-5-5/ the Make blog] by Yoast, the function
> contained filters. These filters were removed in
> [https://core.trac.wordpress.org/changeset/48662 48662] because "the
> function is called too early for any plugins to properly hook into these
> filters".
>
> The only _current_ use of `wp_get_environment_type()` by core is for
> setting the `WP_DEBUG` constant when in a development environment. While
> it's true that filters won't work in that scenario, the filters would be
> useful for themes and plugins.
>
> In my case, I want to set the default environment to "development": while
> there's only one production environment, there are multiple development
> environments that can be created at any time. Setting the environment
> default to "development" means that whenever a new development
> environment is created, the code runs in its safest mode from the start,
> even without explicitly defining `WP_ENVIRONMENT_TYPE` constant.
>
> Reverting [48662] would close this ticket.
New description:
When first introduced and described on
[https://make.wordpress.org/core/2020/07/24/new-wp_get_environment_type-
function-in-wordpress-5-5/ the Make blog] by Yoast, the function contained
filters. These filters were removed in [48662] because "the function is
called too early for any plugins to properly hook into these filters".
The only _current_ use of `wp_get_environment_type()` by core is for
setting the `WP_DEBUG` constant when in a development environment. While
it's true that filters won't work in that scenario, the filters would be
useful for themes and plugins.
In my case, I want to set the default environment to "development": while
there's only one production environment, there are multiple development
environments that can be created at any time. Setting the environment
default to "development" means that whenever a new development environment
is created, the code runs in its safest mode from the start, even without
explicitly defining `WP_ENVIRONMENT_TYPE` constant.
Reverting [48662] would close this ticket.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50896#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list