Title: Order by ABS
Last modified: August 21, 2016

---

# Order by ABS

 *  [korabd](https://wordpress.org/support/users/korabd/)
 * (@korabd)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/order-by-abs/)
 * Currently I am sorting my posts based on custom_field (that is a number).
 * However, If I have a posts that have numbers 3 and 12, then the code below sorts
   is 12,3. How do I sort by number?
 * I read you can do it bu using ORDER BY ABS, but I dont know how to implement 
   it in my code below.
 *     ```
       global $paged;
       $curpage = $paged ? $paged : 1;
       $args = array('post_type' => 'biznese',
               'paged' => $curpage,
         	'meta_query' => $metaquery,
       	'posts_per_page' => 12,
       	'meta_key'=>'renditja',
        	'orderby' => 'meta_value',
       	'order' => 'asc'
       );
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [korabd](https://wordpress.org/support/users/korabd/)
 * (@korabd)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/order-by-abs/#post-3793535)
 * nevermind, I found it
 * just need to change
 * `'orderby' => 'meta_value',`
 * to
 * `'orderby' => 'meta_value_num',`

Viewing 1 replies (of 1 total)

The topic ‘Order by ABS’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [korabd](https://wordpress.org/support/users/korabd/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/order-by-abs/#post-3793535)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
