Support » Plugin: The Events Calendar » [Plugin: The Events Calendar] Events Calendar adds functions to WP_Query filters and never removes t

  • If you’re running a Tribe query, some functions are added to filters that are basic to the WP_Query class, which is making for some¬†unexpected SQL in following custom queries which have nothing to do with events.

    Tracked it down to these specific filter adds:

    lib/tribe-event-query.class:31 add_filter( ‘posts_join’, array(__CLASS__, ‘setupJoins’ ), 10, 2 );
    lib/tribe-event-query.class:33 add_filter( ‘posts_fields’, array(__CLASS__, ‘setupFields’ ) );

    There should be a complementing method in this class, that hooks onto the end of the WP Query and removes these filters.

    http://wordpress.org/extend/plugins/the-events-calendar/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Rob La Gatta

    (@roblagatta)

    Hi, Eric. Thanks for the report on this and apologies that we’ve taken some time to get you a response here. This is a solid bit of feedback and while it’s outside my particular area of expertise, I’ve asked Paul – the lead dev behind this plugin – to take a look and see what’s up here. If upon reviewing your note he sees action is needed, we’ll definitely work it into one of our next monthly maintenance releases.

    Stay tuned and thanks again for the heads up, and your support so far.

    Plugin Contributor Daniel Dvorkin

    (@mzaweb)

    Hey Eric!

    Both lines are wrapped inside a big IF which should be true only when post_type == TribeEvents::POSTTYPE, so… could you please post (or PM me if you prefer) in which scenario you are getting this filters interfering with your queries so I can debug and test?

    Thanks!

    Hey MZAWeb,

    here’s the issue.

    We created a custom page template. We’re running a couple queries one after the other, a la:

    [Custom Query 1]
    [Tribe Events]
    [Custom Query 2]

    The filters I mentioned earlier get the Tribe events specific functions added on to them. However at [Custom Query 2] these functions are still attached to the filter, so unnecessary joins are being added to [Custom Query 2], which should not be there.

    Let me know if that makes sense.

    Plugin Contributor Daniel Dvorkin

    (@mzaweb)

    Makes sense! Interesting that this wasn’t reported yet. I see where we need to clean after the query now. I’ll log this in our tickets for resolution.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: The Events Calendar] Events Calendar adds functions to WP_Query filters and never removes t’ is closed to new replies.