• Resolved KZeni

    (@kzeni)


    What I have set up

    I have The Events Calendar (with Pro) and then W3 Total Cache with Redis-based object cache enabled.

    I then have the tribe_events_get_the_excerpt filter used to append a Read More link to the end of the excerpt (a-la https://theeventscalendar.com/blog/tips/under-the-hood-filtering-excerpts-events-calendar/ where it uses get_permalink(get_the_ID()) from within that filter to get the event’s permalink to then output.

    Problem I’m having

    However, it appears that a list of events on a public webpage (ex. an event list for a venue) will have that permalink added to the excerpt as repeating the same permalink across multiple events even though the events have unique permalinks.

    I tried to have the tribe_events_get_the_excerpt filter pull in $post as the secondary attribute, but that would simply return nothing (I only found spots where it seemed like that variable should be passed along with the filter so I’m not sure how that was ending up being blank).

    Possible solution…?

    The best solution I could find was to disable W3TC’s object cache. The links inserted into the event excerpts went back to being unique & set to the correct event. This isn’t quite ideal as this conflict seems non-obvious where nothing else is broken when the W3TC object caching is enabled & it’d be ideal to keep this caching optimization enabled.

    Is there an object cache group that needs to be set to be non-persistent to avoid this (a-la disabling minify for various assets)? Otherwise, is there a patch that could be made so that this use case doesn’t encounter this bug?

    As a side note, https://theeventscalendar.com/known-issues/ just had a “All events have the same title on the WordPress Dashboard” issue fixed in The Events Calendar 5.12.0 where Redis caching would cause an issue. It seems like this might be a related issue just affecting a different part of things.

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey @kzeni

    Thank you for reaching out.

    Before diving deeper, would you mind making the following recommended tweaks to W3TC and see if that helps? https://theeventscalendar.com/knowledgebase/k/using-the-events-calendar-with-w3tc/

    Let us know,
    Geoff

    Thread Starter KZeni

    (@kzeni)

    @geoffbel Yeah, this is specifically regarding object cache (via Redis) when that page currently only talks about minify.

    It turns out that the tribe_events_get_the_excerpt filter’s function needs to have $post provided as the second parameter to pass along that object for the excerpt being filtered (can’t rely on it pulling the $post object from elsewhere due to object caching getting confused). Also, the filter then needs to have $accepted_args set to 2 for the add_filter call (priority can stay at the default of 10) a-la add_filter('tribe_events_get_the_excerpt', 'tribe_add_view_event_link_after_excerpt', 10, 2); so that $post is able to be passed along as a attribute/parameter.

    You can also reference https://gist.github.com/deblynprado/351d800e8889c36ebf5552997cb439b1 as a complete code snippet (this actually having the link added before the excerpt, but it’s a quick adjustment to the code to have it added after the excerpt [importantly then having the code ready to handle the use of object cache.])

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘tribe_events_get_the_excerpt filter has potential object cache conflict’ is closed to new replies.