Forums › Forums › Search & Filter Pro › Filter by year with date string from ACF
Tagged: results date
- This topic has 4 replies, 2 voices, and was last updated 6 years, 1 month ago by
Trevor.
-
Anonymous(Private) October 5, 2020 at 3:42 pm #261915
Hi there, I would like to use a date field from the WordPress Plugin Advanced Custom Fields in the search form UI. And I want to use only the “year” out of this date string to filter the results.
At the moment the filter dropdown shows and uses the whole string with the format YYYYMMDD.Trevor(Private) October 6, 2020 at 12:54 pm #262052You would need a separate ‘Year’ field to filter by. You could make that an autosave value (each time an event/post is saved, WordPress would extract the year for you). The autosave idea is discussed in the post:
https://support.searchandfilter.com/forums/topic/datefilter/page/3/#post-238869
Anonymous(Private) October 7, 2020 at 9:10 pm #262321Thanks for your answer Trevor. I now have a separate ACF Field which stores only the year value. But when I try to use it as meta field filter, no options in the dropdown on the front end show up. I updated every article to regenerate the date in the new field. So there is content to use as filter options. Any idea what the problem could be?
-
AuthorPosts