Move get_meta_type() into the WP_Meta_Query class as get_cast_for_type(). WP_Query can then access it like: $this->meta_query->get_cast_for_type().

See #21621, [25255].



git-svn-id: https://develop.svn.wordpress.org/trunk@25269 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-05 23:31:28 +00:00
parent d765349b75
commit a73d205ab8
2 changed files with 26 additions and 27 deletions

View File

@@ -2421,11 +2421,11 @@ class WP_Query {
case $q['meta_key']:
case 'meta_value':
if ( isset( $q['meta_type'] ) ) {
$meta_type = get_meta_type( $q['meta_type'] );
$meta_type = $this->meta_query->get_cast_for_type( $q['meta_type'] );
$orderby = "CAST($wpdb->postmeta.meta_value AS {$meta_type})";
} else {
$orderby = "$wpdb->postmeta.meta_value";
}
}
break;
case 'meta_value_num':
$orderby = "$wpdb->postmeta.meta_value+0";