Reply To: Category ordering on the "Frontend Search Settings" doesn't work

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Category ordering on the "Frontend Search Settings" doesn't work Reply To: Category ordering on the "Frontend Search Settings" doesn't work

#16397

Ernest Marcinko
Keymaster

Hi Alekos,

Thank you, I was able to log-in and do some tests.

I believe there is something affecting the built in get_terms() function. I have tested the order which the search requests the categories, which is the correct order:

69, 3, 2, 42, 43, 49, 44, 45, 46, 47, 40, 38, 39, 70, 37, 63, 64, 51, 67

..but the functions returns them in this order (this is what is then outputted):

2, 3, 40, 39, 38, 37, 42, 43, 44, 45, 46, 47, 49, 51, 69, 70, 63, 64, 67

This should not be happening, and I have no idea why that function returns the incorrect order, and it would be probably a nightmare to debug it.

Instead, I have quickly made a custom filter function, that replaces the current method of getting the terms bulk, at once, by getting them one-by-one, and then merging them to an array. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

This should hopefully fix the problem.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)