Wordpress-seo: Still Timber conflict with Yoast 8.1

Created on 28 Aug 2018  路  19Comments  路  Source: Yoast/wordpress-seo

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.

Fatal error: Method TimberFunctionWrapper::__toString() must not throw an exception, caught TypeError: Argument 1 passed to WPSEO_Admin_Bar_Menu::get_post_focus_keyword() must be an instance of WP_Post, instance of TimberPost given, called in /www/htdocs/*/*/wp-content/plugins/wordpress-seo/inc/class-wpseo-admin-bar-menu.php on line 204 in /www/htdocs/*/*/wp-content/cache/gantry5/g5_hydrogen/twig/24/24c6316e467146f08591c6bbd84779624a602cf365eeb21f550e1eaf4f0a50b2.php on line 0

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.1
  3. Create a blog post
  4. Be logged in
  5. Have the Yoast-Adminbar-menu activated
  6. View the blog post

Additional context

Seems to still be the same bug as #10646 but now just for a part of the admin menu bar.

wait for feedback

Most helpful comment

Workaround for now is to toggle "Admin bar menu" off in Yoast under SEO > General > Features

All 19 comments

Confirmed

Tested this on several Timber sites and it's still bugged unfortunately.

Thanks for reporting this. I've created https://github.com/Yoast/wordpress-seo/issues/10836 to resolve this and check for other occurrences.

A user reports

It appears that your code is trying to enforce passing type Post, when it is passing TimberPost (which for all intensive purposes is the same thing). By removing the type Post, the argument gets passed (TimberPost) and seems to work ok. Also, there are 2 places the type is specified but only two.

Please inform the customer of conversation # 415925 when this conversation has been closed.

Please inform the customer of conversation # 420286 when this conversation has been closed.

Workaround for now is to toggle "Admin bar menu" off in Yoast under SEO > General > Features

Please inform the customer of conversation # 422478 when this conversation has been closed.

Please inform the customer of conversation # 426843 when this conversation has been closed.

Please inform the customer of conversation # 429447 when this conversation has been closed.

This issue also occurs when using the 3rd party WP Permastructure plugin.

Wed Oct 03 13:20:14.255563 2018] [:error] [pid 30379] [client 82.42.143.52:50126] PHP Fatal error: Uncaught TypeError: Argument 2 passed to wp_permastructure::parse_permalinks() must be an instance of WP_Post, instance of stdClass given, called in /wp-includes/class-wp-hook.php on line 286 and defined in /wp-content/plugins/wp-permastructure/wp-permastructure.php:244\nStack trace:\n#0 /wp-includes/class-wp-hook.php(286): wp_permastructure->parse_permalinks('https://pyramid...', Object(stdClass), false)\n#1 /wp-includes/plugin.php(203): WP_Hook->apply_filters('https://pyramid...', Array)\n#2 /wp-includes/link-template.php(240): apply_filters('post_link', 'https://pyramid...', Object(stdClass), false)\n#3 /wp-content/plugins/wordpress-seo-premium/inc/sitemaps/class-post-type-sitemap-provider.php(605): get_permalink(Object(stdClass))\n#4 /wp-content/plugins/wordpress-seo-premium/inc/sitemaps/class-post-type-s in /wp-content/plugins/wp-permastructure/wp-permastructure.php on line 244

@Caemor and others who are having this issue, could you test the following Zip of Yoast SEO which should include a fix for this issue and let us know if that works for you? If you still encounter issues, could you post some screenshots of the error messages here? Thanks!

wordpress-seo-timber-fix.zip

@benvaassen Your zip resolved the issue for me. I was able to enable both Yoast, Gantry 5, and the Yoast admin bar menu.

The actual Version 9.0.0 breaks still timber! The Zip from benvaassen (Yoast SEO (beta) | 10825-check-wrong-argument | 09-10-2018 10:21) with Version 9.0.1 works for me.

I can confirm the beta package fixes the issue. But the issue is not fixed in 9.0.3.

This is to be expected as the fix is planned to be included in Yoast SEO v9.1 which isn't released yet.

Ok, I was not aware. Thank you for the information!

Having the same issue. So the solution is to add the patch sent here and keep that till it is completely stable in future versions?

From my initial testing it seems that this issue can be addressed by changing your template code slightly.

I've described the issue here.

Was this page helpful?
0 / 5 - 0 ratings