diff --git a/wp-includes/class-wp-object-query.php b/wp-includes/class-wp-object-query.php deleted file mode 100644 index 72aa093022..0000000000 --- a/wp-includes/class-wp-object-query.php +++ /dev/null @@ -1,36 +0,0 @@ - diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 3980ab1e98..eee2a782ec 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -197,7 +197,7 @@ function get_comments( $args = '' ) { * * @since 3.1.0 */ -class WP_Comment_Query extends WP_Object_Query { +class WP_Comment_Query { /** * Execute the query diff --git a/wp-includes/meta.php b/wp-includes/meta.php index c9f5cddbc1..164d8b2174 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -444,6 +444,30 @@ function get_meta_sql( $meta_query, $meta_type, $primary_table, $primary_id_colu return apply_filters_ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $meta_type, $primary_table, $primary_id_column, &$context ) ); } +/* + * Populates the $meta_query property + * + * @access private + * @since 3.1.0 + * + * @param array $qv The query variables + */ +function _parse_meta_query( &$qv ) { + $meta_query = array(); + + // Simple query needs to be first for orderby=meta_value to work correctly + foreach ( array( 'key', 'value', 'compare', 'type' ) as $key ) { + if ( !empty( $qv[ "meta_$key" ] ) ) + $meta_query[0][ $key ] = $qv[ "meta_$key" ]; + } + + if ( !empty( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ) { + $meta_query = array_merge( $meta_query, $qv['meta_query'] ); + } + + $qv['meta_query'] = $meta_query; +} + /** * Retrieve the name of the metadata table for the specified object type. * diff --git a/wp-includes/query.php b/wp-includes/query.php index cfd780c325..47cf57d248 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -688,7 +688,7 @@ function the_comment() { * * @since 1.5.0 */ -class WP_Query extends WP_Object_Query { +class WP_Query { /** * Query vars set by the user @@ -1347,7 +1347,7 @@ class WP_Query extends WP_Object_Query { $this->parse_tax_query( $qv ); - $this->parse_meta_query( $qv ); + _parse_meta_query( $qv ); if ( empty($qv['author']) || ($qv['author'] == '0') ) { $this->is_author = false; diff --git a/wp-includes/user.php b/wp-includes/user.php index 22bc85b08a..bb6ff8b45f 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -330,7 +330,7 @@ function delete_user_option( $user_id, $option_name, $global = false ) { * * @since 3.1.0 */ -class WP_User_Query extends WP_Object_Query { +class WP_User_Query { /** * List of found user ids @@ -463,7 +463,7 @@ class WP_User_Query extends WP_Object_Query { $this->query_where .= $this->get_search_sql( $search, $search_columns, $wild ); } - $this->parse_meta_query( $qv ); + _parse_meta_query( $qv ); $role = trim( $qv['role'] ); $blog_id = absint( $qv['blog_id'] ); diff --git a/wp-settings.php b/wp-settings.php index 3d7e28ae57..73631e0ae7 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -103,7 +103,6 @@ wp_not_installed(); // Load most of WordPress. require( ABSPATH . WPINC . '/class-wp-walker.php' ); require( ABSPATH . WPINC . '/class-wp-ajax-response.php' ); -require( ABSPATH . WPINC . '/class-wp-object-query.php' ); require( ABSPATH . WPINC . '/formatting.php' ); require( ABSPATH . WPINC . '/capabilities.php' ); require( ABSPATH . WPINC . '/query.php' );