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

WordPress Trac noreply at wordpress.org
Tue Aug 11 16:29:49 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):

 Here's what I'm working with at the moment:

 {{{#!php
 <?php
 function wp_get_environment_type() {
         static $current_env = '', $filtered_env = '';

         if ( $filtered_env ) {
                 return $filtered_env;
         }

         if ( did_action( 'muplugins_loaded' ) ) {
                 $filtered_env = apply_filters( 'wp_get_environment_type',
 $current_env );
                 return $filtered_env;
         }

         if ( $current_env ) {
                 return $current_env;
         }

         ...
 }
 }}}

 IMO the ideal solution does not require two static variables (what I'm
 working on currently), but a solution that does not use two static
 variables is (feeling) unlikely to be simple or elegant.

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


More information about the wp-trac mailing list