Title: Ordering Custom Posts by Custom Fields not working
Last modified: August 20, 2016

---

# Ordering Custom Posts by Custom Fields not working

 *  [NockerGeek](https://wordpress.org/support/users/nockergeek/)
 * (@nockergeek)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/ordering-custom-posts-by-custom-fields-not-working/)
 * The ‘orderby’ value of ‘meta_value’/’meta_value_num’ no longer appears to work
   properly in 3.4.x. I’ve got a plugin to add a custom post type for video media,
   and in 3.3.2, the following query works just fine:
 *     ```
       $args = array(
       		'numberposts' => -1,
       		'post_type' => 'video',
       		'meta_key' => 'videoOrder',
       		'orderby' => 'meta_value_num',
       		'order'=>'ASC',
       		'post_status'=>'publish'
       );
   
       $videos = get_posts($args);
       ```
   
 * The same code, however, does not work in 3.4.x. The order and orderby parameters
   seem to be ignored. Again, it works just fine in 3.3.2, but not in either 3.4
   or 3.4.1. Is anyone else having similar issues?

Viewing 1 replies (of 1 total)

 *  [Marventus](https://wordpress.org/support/users/marventus/)
 * (@marventus)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/ordering-custom-posts-by-custom-fields-not-working/#post-2859648)
 * Hi.
    The problem could be coming from your `numberposts` value. Try changing 
   to a positive integer greater than 1 to see if the sort method works. Cheers!

Viewing 1 replies (of 1 total)

The topic ‘Ordering Custom Posts by Custom Fields not working’ is closed to new 
replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [custom post](https://wordpress.org/support/topic-tag/custom-post/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Marventus](https://wordpress.org/support/users/marventus/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/ordering-custom-posts-by-custom-fields-not-working/#post-2859648)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
