Wordpress query_posts Custom Field Order

I am trying to streamline my results using the query_posts function with a custom field.

Here is my modified query_posts () function:

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

The price looks like this: {Euro}. {Cent}, for example 1.49.

And the query_posts () function orders this incorrectly. The result is ordered as follows:

0.49, 1.99, 0.99

What is going wrong?

Thank Advance

+5
source share
1 answer

You can try this (I hope it will work / found on the Internet)

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

Another answer to SO .

+8
source

All Articles