Support Forums

Support Forums Forums Search & Filter Pro Date ranges with Search & Filter Pro and Events Manager

This topic is: not resolved

Tagged: , ,

Viewing 10 posts - 1 through 10 (of 11 total)
  • Joe Bolland


    I’m developing an events listing here:

    It uses Events Manager, and Search and Filter Pro to filter the listing. The category filtering and search is working fine, but I’m having a problem with date ranges.

    I saw your other posts about the incompatibility between how Events Manager saves dates and how S&F works with them, and wrote this hook:

    // Convert Events Manager dates yyyy-mm-dd to yyyymmdd and save to an ACF field, for Search & Filter Pro to use
    function save_event_meta( $post_id ){
    if (get_post_type($post_id) == 'event'):
    $filter_event_start_date = date("Ymd", strtotime(get_post_meta($post_id, '_event_start_date', true)));
    $filter_event_end_date = date("Ymd", strtotime(get_post_meta($post_id, '_event_end_date', true)));
    update_field( 'filter_event_start_date', $filter_event_start_date , $post_id );
    update_field( 'filter_event_end_date', $filter_event_end_date , $post_id );
    add_action('acf/save_post', 'save_event_meta', 20); // run before ACF saves the $_POST['fields'] data

    This converts the start and end dates from yyyy-mm-dd to yyyymmdd and saves them to fields. Numerical sorting based on this start date field works.

    However, when I try to do a date range filter it doesn’t return any results. I’m at a bit of a loss, and was wondering if it’s because the querystring the datepicker creates is in a different format?

    Any suggestions would be appreciated.


    Trevor Moderator
    This reply has been marked as private.
    Joe Bolland
    This reply has been marked as private.
    Trevor Moderator
    This reply has been marked as private.
    Trevor Moderator

    Hi Joe

    I have looked at this again, and still cannot see an issue with what you have done. If you put WordPress into debug mode, does it output any errors? Does your server log any PHP or MySQL errors?

    Joe Bolland


    I’ve set define( ‘WP_DEBUG’, true ); now in wp-config.php. Does that help?

    I can’t see any error log files when I look on the server, but I can ask the host’s support team.

    Trevor Moderator

    If no error messages appear on the page, that means WordPress seems happy, so next check with the host to see if PHP and SQL error logging are on, and if so, to where?

    Joe Bolland

    The host says there are no errors coming up in their logs.

    Do you have any other suggestions? If not we can carry on using it elsewhere in the site but will need to do something else for events.

    Thanks for your help on this.

    Trevor Moderator

    The only other thing I can think of is that the events post type is somehow oddly defined by that plugin.

    Joe Bolland

    OK, I think we’ll probably have to do events differently then.


Viewing 10 posts - 1 through 10 (of 11 total)

You must be logged in to reply to this topic.