[wp-hackers] Possible Wordpress or MySQL bug on different Ubuntu versions?

Nathaniel Taintor goldenapplesdesign at gmail.com
Wed Jan 30 23:40:07 UTC 2013


An interesting issue posed by this question, though, is how the "orderby"
array in WP_Query is parsed.

It strikes me that issues like this would be more easily managed if a query
that includes

    'orderby' => 'meta_value_num ID'
    'order' => 'DESC'

was parsed to the SQL one would expect, ie

    'ORDERBY wp_postmeta.meta_value+0 DESC, wp_posts.ID DESC',

rather than

    'ORDERBY wp_postmeta.meta_value+0, wp_posts.ID DESC'

Maybe even better would be if the orderby query variable could be extended
to take an array of parameters and orders, ie

    'orderby' => array(
        array(
            'param' => 'meta_value_num',
            'order' => 'DESC'
        ),
        array(
            'param' => 'ID',
            'order' => 'ASC'
        ),
    ),

I don't see any tickets related to that on trac right now. Has it been
discussed as a possible enhancement?


More information about the wp-hackers mailing list