[wp-trac] [WordPress Trac] #19041: function to list all (true) conditionals (in an array)

WordPress Trac wp-trac at lists.automattic.com
Mon Jun 4 23:29:16 UTC 2012


#19041: function to list all (true) conditionals (in an array)
-----------------------------------+------------------------------
 Reporter:  F J Kaiser             |       Owner:  F J Kaiser
     Type:  enhancement            |      Status:  assigned
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Query                  |     Version:  3.3
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------------------

Comment (by scribu):

 For reference, here's how I do it:

 {{{
 // Returns an array containing the flags that have been set
 function get_query_flags( $wp_query = null ) {
         if ( !$wp_query )
                 $wp_query = $GLOBALS['wp_query'];

         $flags = array();

         foreach ( get_object_vars( $wp_query ) as $key => $val ) {
                 if ( 'is_' == substr( $key, 0, 3 ) && $val )
                         $flags[] = substr( $key, 3 );
         }

         return $flags;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19041#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list