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?
- Activate the Timber plugin
- Activate Yoast 8.0
- Create a blog post
- 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 )
Crossposting from wp.org https://wordpress.org/support/topic/admin-bar-menu-error
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.