Yoast/wordpress-seo

Version 8.0 conflict with Timber

Closed this issue · 8 comments

Please give us a description of what happened.

When Yoast 8.0 and Timber plugins are both active viewing a blog post while logged in errors with the following.

Uncaught TypeError: Argument 1 passed to WPSEO_Admin_Bar_Menu::get_post_score() must be an instance of WP_Post, instance of Timber\Post given

Please describe what you expected to happen and why.

I expect to be able to view the post as normal.

How can we reproduce this behavior?

  1. Activate the Timber plugin
  2. Activate Yoast 8.0
  3. Create a blog post
  4. View the blog post

Additional context

The problem seems to be the fact that Timber implements it's own Post class known as Timber\Post while the following function in the class-wpseo-admin-bar-menu.php file is enforcing the $post to be a WP_Post.

protected function get_post_score( WP_Post $post )

same error as well. +1

Thanks for reporting this issue! We've immediately created a PR to fix this.

It's scheduled to be included in 8.1.

@benvaassen I've updated the plugin to version 8.1 now. I'm afraid it still contains the same issue here. (Currently looking at pages with post loops on them (Timber + Yoast activated))

Yes i can confirm!

I can confirm too, site still broken after update to 8.1 ... :-(

The fix they implemented covered an issue in the code (regarding a Wp Post VS a Timber Post type), but there is another place this type issue is happening (=> get_post_focus_keyword function). Probably fixable in the same way. I'm not sure if this would resolve the issue entirely.

Thanks for following up. Please check issue #10825 fo this specific error and #10836 for a more global check, since this issue is closed and it's technically a different error now.