WordPress.org

Make WordPress Core

Ticket #19041: 19041.patch

File 19041.patch, 910 bytes (added by F J Kaiser, 7 years ago)

replaced patch

  • wp-includes/query.php

     
    716716}
    717717
    718718/**
     719 * List all conditionals that are true
     720 *
     721 * @see WP_Query
     722 * @since 3.3
     723 * @uses $wp_query
     724 *
     725 * @return (array) $conditionals | Numerical array holding all conditionals that are true
     726 */
     727function get_conditionals() {
     728        global $wp_query;
     729
     730        if ( ! isset( $wp_query ) ) {
     731                _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
     732                return false;
     733        }
     734
     735        foreach ( array_keys( (array) $wp_query ) as $is_ )
     736        {
     737                if ( $wp_query->$is_ && preg_match( "/is_/", $is_ ) )
     738                        $conditionals[] = $is_;
     739        }
     740
     741        return $conditionals;
     742}
     743
     744/**
    719745 * Is the query the main query?
    720746 *
    721747 * @since 3.3.0