ACF Relationship filed does only show upcoming events

Home Forums Calendar Products Events Calendar PRO ACF Relationship filed does only show upcoming events

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #266797
    Tony Svensson
    Participant

    As the title describes i can only view upcoming events in ACF Relationship field (Advanced Custom Fields).
    This may have something to do with TEC pre query is affecting get_posts or similar?
    Can this be avoided?

    Thanks

    #269891
    Barry
    Member

    Hi – great question!

    When WordPress queries run, if The Events Calendar detects that the query relates to events it does apply a little magic of its own – and, in the absence of other criteria it will indeed assume that only upcoming (future) events should be returned.

    It’s definitely possible to prevent this, though, but what I can’t answer off the top of my head is how you might do this selectively so as only to impact on this particular scenario with ACF. The basic approach though would be something like this:

    add_action( 'init', 'strike_down_tribe_query_filters', 20 );
    
    function strike_down_tribe_query_filters() {
        remove_action( 'parse_query', array( 'TribeEventsQuery', 'parse_query' ), 50 );
        remove_action( 'pre_get_posts', array( 'TribeEventsQuery', 'pre_get_posts' ), 50 );
    }

    Of course you’d need to adjust and add some criteria so as only to do this in select situations.

    Does that help at all?

    #701595
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘ACF Relationship filed does only show upcoming events’ is closed to new replies.