Ask your WordPress questions! Pay money and get answers fast! (more info)

Fix WordPress Advanced Search WordPress

  • SOLVED

I am using this https://github.com/growthspark/wp-advanced-search

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:

https://github.com/growthspark/wp-advanced-search/issues/44

Answers (2)

2014-02-09

Hariprasad Vijayan answers:

Hello,
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.

2014-02-09

Sabby Sam answers:

Hi
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.