Home Forums Event Espresso Premium Previous version

Previous version

Posted: May 6, 2024 at 6:25 am


May 6, 2024 at 6:25 am

Dear all,

Our code breaks with the latest version 5.0.19p.
While we’re fixing it, could you please send us the previous version:
Event Espresso 4 Core Regular v5.0.18.p

Thank you and kind regards.


May 6, 2024 at 6:33 am

Extending on the break: with the latest version you enforce the type signature WP_POST for public function the_post(WP_Post &$post) within EE_CPT_Event_Strategy. Given that we’re using Timber, the type of the post is Timber\Post.

I think EE should loosen the constraint.

Fatal error: Uncaught Error: EE_CPT_Event_Strategy::the_post(): Argument #1 ($post) must be of type WP_Post, Timber\Post given, called in wp-includes/class-wp-hook.php on line 326
in wp-content/plugins/event-espresso-core-reg/core/CPTs/EE_CPT_Event_Strategy.core.php on line 251


  • Support Staff

May 6, 2024 at 7:03 am

This reply has been marked as private.


  • Support Staff

May 7, 2024 at 4:50 pm

Hi there,

Are you using Timber v1 or v2?

We did some investigating for this and EE_CPT_Event_Strategy hooks into the_post for the above, the object passed to the_post should always be some form of WP_Post object, which Timber\Post is not.

So the issue here is something is returning a completely different object than what is expected for the_post filter, loosening the constraint within EE isn’t the right solution here.

On checking within the current Timber codebase I can’t find anywhere in which the_post would return a Timber\Post object so I’m guessing this is being set within your theme?

Our developer reached out to Timber to ask about this, this was the response:

I tried to reproduce the issue to see whether we missed something, but I can’t find an issue with Timber core itself. So I suspect that there’s something else going on.

It could be the theme or a plugin that adds a hook for the_post as well.

Because Timber v1 hooked into the_post every time a Timber\Post was instantiated, some developers might have applied fixes themselves. We resolved this issue in Timber 2.0 so that the_post action is only called when looping over posts. On singular templates, $post->setup() has to be called manually. So any custom fix for this might not be needed anymore.

Some relevant documentation:

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso