Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search by date range with custom fields datepicker not working › Reply To: Search by date range with custom fields datepicker not working
Thank you very much for the details. It was not your fault, there was indeed a confusion.
The ACF5 and the MySQL datetime values are the same, it should have been removed and renamed. In your case the correct choice is ACF4, which is actually the Date picker in ACF. I have changed that for you, and also noticed that the custom field logic was changed from the default ‘AND’ to ‘OR’, which was causing the main issue, as the OR logic means, that any of the chosen dates are sufficient to match – which is almost always true (and not correct): https://i.imgur.com/yv08Bat.png
It should be okay now, however I have noticed that the day is not inclusive as it should be, this is related to the previous issue. I’ve looked up the plugin source, and made similar test fields. So choosing the day actually only includes results from starting the next day, which is not okay.
After some testing I solved the issue, but one file needs to be replaced in the plugin directory to fix it, there is no other way unfortunately.
To fix it manually, please follow these instructions. If you can’t do it, feel free to leave temporary FTP access, and I will do it for you.
- 0. Make sure to have a back-up before editing the files.
- 1. Open up the wp-content\plugins\ajax-search-pro\includes\classes\etc\class-asp_helpers.php file on your server via FTP
- 2. Change it’s complete contents to this: https://goo.gl/tNecGA
- 3. Save the file
After this, the date should be inclusive to the selected date, and work correctly. I will of course include this fix in the next release of the plugin, and make sure to correct the date field names as well. Sorry about the inconvenience. Let me know if you need help with this.Best,
If you like my products, don't forget to rate them on codecanyon :)