• Hi this one really has me stumped. I’m using meta_value_num to sort my custom post (using WPAlchemy) based on the custom field ‘cost’ which contains the cost of a product.

    Rather then sorting as expected it seems to be sorting the posts as if i were using meta_value. I have 3 price points and it is sorting:

    10, 1, 5 rather then 10, 5, 1.

    Below is my code

    $args2 = array( 'post_type' => 'instant_game_page', 'orderby'   => 'meta_value_num', 'meta_key'  => $instants_mb->the_value('cost'), 'order' => 'DESC', 'category_name' => $slug,   );

    Any help or suggestions would be greatly appreciated. Thanks

  • The topic ‘meta_value_num is not sorting my posts correctly please help’ is closed to new replies.