Filter by year with date string from ACF

Forums › Forums › Search & Filter Pro › Filter by year with date string from ACF

Tagged: 

Viewing 5 posts – 1 through 5 (of 5 total)
  • Anonymous
    #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
    #262052

    You 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
    #262321

    Thanks 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?

    Anonymous
    #262327

    Solved it by myself. Thanks anyway!

    Trevor
    #262329

    Thanks for letting me know. I will close this thread for now.

Viewing 5 posts – 1 through 5 (of 5 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.