Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Fix WordPress Advanced Search WordPress


I am using this

but I cannot get it working properly with a sort meta key. I have the value saved in the database as something like 1000 or 250 or 2500. But it is not sorting correctly.

Please read over the issue here and let me know if you can help:

Answers (2)


Hariprasad Vijayan answers:

Try to set order by as "meta_value_num" when you need to sort based on number. Like

'blank' => array('label' => ''),
'Amount' => array('label' => 'Amount',
'meta_key' => true,
'orderby' => 'meta_value_num'),

You can see the script checking for meta_value_num in "orderby" case. Probably it is missing
check wpas.php line no : 110

Hope it help you.


Sabby Sam answers:

Did you tried changing the value to string and then searched.

Sabby Sam comments:

Also why this one ( 'title' => 'Order by', ), can you remove this one as well.