[wp-hackers] get_posts() meta_key numeric search

Christopher Ross cross at thisismyurl.com
Fri Jun 8 11:46:28 UTC 2012


I'm calling a get_posts() function using the meta_key to sort but it's returning the 1's out of order at the moment. For example:

$args = array(
        'numberposts'     => 30,
	'meta_key'        => 'image_score_' . $user_id,
        'orderby'         => 'meta_value',
	'order'         	=> 'DESC',
    );

Will return 99,98,9,100,10,1 instead of 100,99,98,10,9,1

I could loop into an array first and fix it but is there a way to force the sort order straight out of the get_posts()?

--

Christopher Ross : @thisismyurl : Pinterest : Facebook : LinkedIn : Google+
Telephone: (506) 455-4122

399 King Street,
Fredericton, New Brunswick
E3B 3E5

Photography : Blog






More information about the wp-hackers mailing list