[wp-trac] [WordPress Trac] #21621: setting meta_type doesn't CAST orderby value

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 26 05:59:35 UTC 2012


#21621: setting meta_type doesn't CAST orderby value
----------------------------+------------------------------
 Reporter:  wonderboymusic  |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Query           |     Version:  3.2
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------------------

Comment (by wonderboymusic):

 I think this is mainly for top-level meta query - meta_key, meta_value and
 the like - meta_value_num is the only way to cast. And I think top-level
 is the main use case (I hope to jesus people aren't creating many arrays
 of meta_value LONGTEXT comparisons - barf).

 My example from the ticket - I don't care if we ditch the patch for now,
 but it *does* work
 {{{
 $stuff = new WP_Query( array(
         'fields' => 'ids',
         'post_type' => 'any',
         'meta_key' => 'num_as_longtext',
         'meta_value' => '0',
         'meta_compare' => '>',
         'meta_type' => 'UNSIGNED',
         'orderby' => 'meta_value',
         'order' => 'ASC'
 ) );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21621#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list