Wordpress query_posts Order By Custom Field

sql-order-by, wordpress

Solution

You may try this (hopefully it'll work/found online)

query_posts( "post_type=produkte&".$query_string."&meta_key=Price&orderby=meta_value_num&order=DESC" );

Another answer on SO.

Problem

i'm trying to order my results with query_posts function by a custom field. Here is my edited query_posts() function: ``` query_posts( "post_type=produkte&".$query_string."&orderby=Price&order=DESC" ); ``` The Price looks like that {Euro}.{Cent} for example 1.49. And the query_posts() function orders it not right. The result is ordered like that: 0.49, 1.99, 0.99 What is going wrong? Thanks in Advance!

Original source