Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.77k stars 893 forks source link

Saving a big post with Yoast enabled is terribly slow. #16713

Closed maciejmackowiak closed 1 year ago

maciejmackowiak commented 3 years ago

Please give us a description of what happened.

  1. Saving posts with a lot of links and images takes ages to save.
  2. The other issue is that it also results in timing out the wp autosave ajax request and triggering "connection lost" notice, luckly it doesn't prevent post from being save because.

Looks like the culprit is Indexable_Link_Builder->build() added to wp_insert_post hook in Indexable_Post_Watcher

I've tested it on blank wp install with only Yoast and classic editor installed: First request is with Yoast enabled and the second one is with Yoast disabled, both requests are wp_autosave: obraz

Here is sample post: https://gist.github.com/maciejmackowiak/277427859825d232fe2a37a21d15d7cf

Please describe what you expected to happen and why.

  1. Optimize the Indexable_Link_Builder or if it is not possible to optimize run it in cron job.
  2. Do not run Indexable_Link_Builder on autosaving posts.

How can we reproduce this behavior?

  1. Create a post with a lot of links and images - https://gist.github.com/maciejmackowiak/277427859825d232fe2a37a21d15d7cf
  2. Try to save/autosave the post.

Technical info

Used versions

amboutwe commented 1 year ago

@bilal-ahmed-dev In my tests, a 302 occurs with or without Yoast, so it seems core-related. Does the 302 happen when Yoast is not active?

bilal-ahmed-dev commented 1 year ago

@amboutwe I have tested this with or without Yoast plugin, disable all plugins and switch theme to default, and i still getting the 302 redirect, so it means this is core functionality of wordpress, but i am not sure there is a need for two requests to save the post.

khanakia commented 1 year ago

I am using Elementor with Yoast and when Yoast is enabled and i click the Update Post it keeps saving for minutes and then times out.

amboutwe commented 1 year ago

@khanakia A fix was included in version 21.3, so please update if you have not done so already.

If the issue remains after updating to 21.3 (or newer) and you're using Elementor galleries (or other non-core gallery features), please implement the suggestion above. Our development team also put together some other examples for different situations here.

JiveDig commented 9 months ago

This is still an issue for us. Is there a way to disable this process from happening altogether? Looking at the various filters just seems to change the way images are processed. I'd rather ignore this step completely so we don't have to disable Yoast every time we save a large post.