WordPress.org

Make WordPress Core

Changeset 15768


Ignore:
Timestamp:
10/09/2010 12:18:52 PM (9 years ago)
Author:
scribu
Message:

Fix warning caused by empty meta query. See #14645

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r15766 r15768  
    21142114        }
    21152115
    2116         list( $meta_join, $meta_where ) = $this->get_meta_sql( $q['meta_query'], $wpdb->posts, 'ID', $wpdb->postmeta, 'post_id' );
    2117         $join .= $meta_join;
    2118         $where .= $meta_where;
     2116        if ( !empty( $q['meta_query'] ) ) {
     2117            list( $meta_join, $meta_where ) = $this->get_meta_sql( $q['meta_query'], $wpdb->posts, 'ID', $wpdb->postmeta, 'post_id' );
     2118            $join .= $meta_join;
     2119            $where .= $meta_where;
     2120        }
    21192121
    21202122        // Apply filters on where and join prior to paging so that any
  • trunk/wp-includes/user.php

    r15766 r15768  
    462462        }
    463463
    464         list( $meta_join, $meta_where ) = $this->get_meta_sql( $qv['meta_query'], $wpdb->users, 'ID', $wpdb->usermeta, 'user_id' );
    465         $this->query_from .= $meta_join;
    466         $this->query_where .= $meta_where;
    467 
    468         if ( !empty($qv['include']) ) {
     464        if ( !empty( $qv['meta_query'] ) ) {
     465            list( $meta_join, $meta_where ) = $this->get_meta_sql( $qv['meta_query'], $wpdb->users, 'ID', $wpdb->usermeta, 'user_id' );
     466            $this->query_from .= $meta_join;
     467            $this->query_where .= $meta_where;
     468        }
     469
     470        if ( !empty( $qv['include'] ) ) {
    469471            $ids = implode( ',', wp_parse_id_list( $qv['include'] ) );
    470472            $this->query_where .= " AND $wpdb->users.ID IN ($ids)";
Note: See TracChangeset for help on using the changeset viewer.