Make WordPress Core

Changeset 16143


Ignore:
Timestamp:
11/01/2010 08:34:54 PM (14 years ago)
Author:
scribu
Message:

Just pass meta type to get_meta_sql(). See #15032

Location:
trunk/wp-includes
Files:
3 edited

Legend:

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

    r16142 r16143  
    8888     *      Default: 'CHAR'
    8989     *
     90     * @param string $meta_type
    9091     * @param string $primary_table
    9192     * @param string $primary_id_column
    92      * @param string $meta_table
    93      * @param string $meta_id_column
    9493     * @return array( $join_sql, $where_sql )
    9594     */
    96     function get_meta_sql( $meta_query, $primary_table, $primary_id_column, $meta_table, $meta_id_column ) {
     95    function get_meta_sql( $meta_query, $meta_type, $primary_table, $primary_id_column ) {
    9796        global $wpdb;
     97
     98        if ( ! $meta_table = _get_meta_table( $meta_type ) )
     99            return false;
     100
     101        $meta_id_column = esc_sql( $meta_type . '_id' );
    98102
    99103        $clauses = array();
     
    158162        }
    159163
    160         return apply_filters( 'get_meta_sql', compact( 'join', 'where' ), $meta_query, $primary_table, $primary_id_column, $meta_table, $meta_id_column );
     164        return apply_filters( 'get_meta_sql', compact( 'join', 'where' ), $meta_query, $meta_type, $primary_table, $primary_id_column );
    161165    }
    162166
  • trunk/wp-includes/query.php

    r16116 r16143  
    21472147
    21482148        if ( !empty( $q['meta_query'] ) ) {
    2149             $clauses = $this->get_meta_sql( $q['meta_query'], $wpdb->posts, 'ID', $wpdb->postmeta, 'post_id' );
     2149            $clauses = $this->get_meta_sql( $q['meta_query'], 'post', $wpdb->posts, 'ID' );
    21502150            $join .= $clauses['join'];
    21512151            $where .= $clauses['where'];
  • trunk/wp-includes/user.php

    r16053 r16143  
    469469
    470470        if ( !empty( $qv['meta_query'] ) ) {
    471             $clauses = $this->get_meta_sql( $qv['meta_query'], $wpdb->users, 'ID', $wpdb->usermeta, 'user_id' );
     471            $clauses = $this->get_meta_sql( $qv['meta_query'], 'user', $wpdb->users, 'ID' );
    472472            $this->query_from .= $clauses['join'];
    473473            $this->query_where .= $clauses['where'];
Note: See TracChangeset for help on using the changeset viewer.