Yoast saving post preview info in Object Cache
-
Hi there,
This bug started after upgrading to Yoast ~14.2. I’m currently using v14.3.
When an author is editing a post and then clicks in “preview”, Yoast saves all the meta information in the object cache. That includes: canonical url, post thumbnail (saves the default image), Breadcrumb, etc.
Then when the post is published, this information isn’t flushed immediately. The canonical stays wrong (?p=312123) and the image thumbs for twitter, google and facebook is the default.
To flush this infos, i need to wait a few minutes and then update the post.
I’m using a Redis Object Cache from Pressjitsu, but the problem is not specific to this opt-in. I’ve already tried to change it to other two WP Redis, and the problem persists. In fact, with this other plugins, even more information is saved, as the breadcrumbs.
Is there a way to stop Yoast from caching stuff when it’s from a post preview URL? I believe that this could fix the error.
I’ve tried removing Yoast header stuff using this code, but it doesn’t fix the problem, since the information is already cached when “template_redirect” is beeing called:
add_action( 'template_redirect', 'remove_yoast_postpreview' ); function remove_yoast_postpreview() { if ( is_user_logged_in() && is_preview() ) { $front_end = YoastSEO()->classes->get( Yoast\WP\SEO\Integrations\Front_End_Integration::class ); remove_action( 'wpseo_head', [ $front_end, 'present_head' ], -9999 ); } }
Maybe there’s a way to stop Yoast from the “init” action, when the request is from a post preview?
Any thoughts?
- The topic ‘Yoast saving post preview info in Object Cache’ is closed to new replies.