Yoast / wordpress-seo

Yoast SEO for WordPress

Home Page:https://yoast.com/wordpress/plugins/seo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When indexable creation is disabled, cleanups are being scheduled upon post creation

leonidasmi opened this issue · comments

If the Yoast\WP\SEO\should_index_indexables filter is enabled and returning false, or we're on a non-production site, we don't create indexables. This has a side-effect:

  • When we save a post, then a cleanup sequence is scheduled (meaning, all the indexable cleanups that we have for orphaned indexables, non-public indexables, etc.)
  • The cleanups, when triggered, will actually do nothing and unschedule themselves (because of that filter, or because we're on a non-production site), so it has minimal impact on the performance of the websites, but still it's a thing to be fixed, because we're scheduling cron jobs needlessly with every post creation/update. UPDATE: The cleanups actions actually do run their cleanup queries, so it's something with more severity than initially reported.

The solution will be:

  • If the filter is enabled when the plugin is enabled the cleanup cron should not be scheduled at all (or other reasons to schedule this cleanup)
  • If the cleanup is already scheduled to be run and the filter is enabled in the meantime it should early abort when running the cleanups.