Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Custom field Date Filter not working
This topic contains 9 replies, has 2 voices, and was last updated by Ernest Marcinko 3 years, 8 months ago.
- AuthorPosts
- March 19, 2020 at 4:13 pm #26301
Hi
I have for each post an acf date-field and would like to have a filter for this.
Creating the filter under “Frontend Search Settings -> Custom Fields” was no problem but it doesn’t work (other filters work fine), I get no searchresults.
Is there a known issue with the date-filter or what could be the reason it doesn’t work for me?
The only thing that stood out was that acf and asp use different date format (“d/m/Y” respectively “yy-mm-dd”) that don’t work for the other. Might this cause the error?Thanks and kind regards
StefanMarch 19, 2020 at 4:36 pm #26302Hi,
There is no known issue with the date filters at the moment for sure. Those are only the display formats, they does not affect the filters.
The two most common issues are, that either the storage format or the operator is set incorrectly: https://i.imgur.com/szBx5FM.png
Best,
At first, I would recommend trying different variations to see if that makes any difference. The default storage format of the filter is “ACF datetime field”, which is not the same as the simple “ACF date” field, I am almost sure, that that is the problem. Try chaning that option first.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 19, 2020 at 4:46 pm #26303Thanks for the quick answer.
I’m not sure if I understand correctly.
Attached screenshots of my settings for the date fields (for acf: “Datum=Date”, “Datum/Uhrzeit = Date/Time”). This should be the same format, right?
I also tried with “Datetime” fields (in either plugin) but that doesn’t work either.Attachments:
You must be logged in to view attached files.March 20, 2020 at 9:12 am #26315You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 20, 2020 at 9:42 am #26320You cannot access this content.March 20, 2020 at 3:28 pm #26326Hi,
Thank you, I have found the problems, it is only the configuration.
1. Issue: The abfahrtsart filter. Items matching that filter does not have either of the dates set, so setting any of the date filters will automatically give you no results whatsoever. You will have to either remove this, or set a value for each element.
2. Issue: The abfahrtsdatum filter Date storage format. It should be the default ACF Datetime field, as it is a datetime field as configured in ACF.
The other filter storage format is okay, as it is ACF Date not datetime.Changing those will resolve the issue 🙂
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 20, 2020 at 4:10 pm #26327Hi Ernest
Thanks for checking but the issue remains.I removed the abfahrtsart filter and changed the abfahrtsdatum storage format to ACF date field.
btw. here’s a test page with the filter on it: http://baumeler.ch.212-25-25-162.plesk01.iway.ch/test-abfahrten
Do you have any other ideas? Otherwise we have to search for another solution for that filter.Kind regards
StefanMarch 20, 2020 at 4:25 pm #26328I removed the abfahrtsart filter and changed the abfahrtsdatum storage format to ACF date field.
It should be the default “Mysql datetime/ACF Datetime” not “ACF Date”: https://i.imgur.com/scgocvk.png
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 20, 2020 at 4:29 pm #26329event though we have no time stored but only a date?
I changed the format in both apps, aps and acf, to “ACF date” fieldMarch 21, 2020 at 9:20 am #26333Yes, it is due to the storage format, date and datetime are very different. I don’t know if changing the format now will trigger ACF to convert all the previous values, so I would rather leave them as it was originally.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.