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

WordPress Trac noreply at wordpress.org
Tue Aug 11 15:51:11 UTC 2020


#50896: Add filters to wp_get_environment_type()
-------------------------+------------------------------
 Reporter:  crstauf      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by crstauf):

 Replying to [comment:1 SergeyBiryukov]:
 > Just noting that simply reverting [48662] won't work as expected. As
 previously noted in comment:58:ticket:33161, the result of the function is
 cached into a static variable (per comment:44:ticket:33161) on the first
 run (which is too early for filters), and cannot be changed later.
 >
 > So we'll also have to remove the static variable, which may lead to
 issues, as noted in comment:44:ticket:33161.

 Oh sweet, I like the use of the static variable; definitely don't think
 that should be removed. It does create a problem though if someone wants
 to change the default environment type.

 Working on a possible solution; the following described approaches do not
 seem to work:

 1. Applying a filter to the static variable defeats the whole purpose of
 the static variable, so that's out.

 2. Defining a constant (ex: `WP_DEFAULT_ENVIRONMENT_TYPE`) creates the
 same problem.

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


More information about the wp-trac mailing list