How to Fix the Yoast SEO Error: “something has gone wrong and we couldn’t complete the optimization of your SEO data”

After installing Yoast Pro and using the “Optimize SEO Data” function, you may encounter an error stating, “Oops, something has gone wrong, and we couldn’t complete the optimization of your SEO data. Please click the button again to re-start the process.” This error is typically caused by invalid previously optimized data or conflicts with other plugins or themes.

It’s important to note that failing to complete the optimization will not negatively impact your search results, as Yoast continues to run optimization processes in the background during content updates. To resolve this issue, consider resetting the optimization to clear any data issues without affecting your SEO efforts.

Note: Back up your website before making any changes to ensure you can quickly restore it if something goes wrong. Tools like WP Staging make it easy to set up automatic backups. For more guidance, check out the backup and restore guide.

Reset Yoast Data

To reset the data, please follow these steps:

Install Yoast Test Helper
  • Go to your WordPress admin dashboard > Tools (sidebar) > Yoast Test
go to tools (sidebar), then yoast test
  • Locate the Yoast SEO section and click on “Reset indexables tables & migrations”, “Reset Prominent words calculation”, and “Reset Internal link counter” buttons. After each click, the page will reload to confirm that each reset was successful.
reset indexables tables & migrations option

Rerun Yoast SEO Data Optimization

Now that we have removed any previously stored data, we’ll need to rerun the data optimization. You have a few options to run the SEO data migration:

  • Inside the WordPress admin area: This is the default method where you typically encounter the optimization error. It involves running the optimization process directly from the Yoast SEO section within your WordPress dashboard.
  • Using WP-CLI commands: This approach is more technical and requires server access through a terminal service. It’s especially recommended for larger sites because it can handle extensive data more efficiently. Your web hosting provider may offer support if you’re not familiar with command-line interfaces.

If the optimization completes successfully after the reset, you are ready to start using Yoast SEO and its features.

Debug JavaScript Errors

If the optimization still fails after resetting, check for JavaScript errors in your browser’s console to identify the issue. For guidance on using the console, see our tutorial on finding JavaScript errors.

javascript browser console

There is a list of known error codes here(step 6) with recommended solutions. If the error is not listed or you have questions about the error, please provide Yoast with a screenshot of the error.

Summary of Findings

The most common causes are invalid previously stored data or a conflict with a plugin or theme on your site. The next steps are:

Related Articles

Author: Rene Hermenau

I'm René Hermenau, founder of WP STAGING. I've been building WordPress infrastructure software since 2013 and writing code on GitHub since 2011. My repos live at github.com/rene-hermenau. WP STAGING started as a small developer project solving the same problem I kept hitting on client work: there was no fast, safe way to clone a WordPress site for staging or migration without breaking serialized data, file paths, or media references. Today we are a team of more than 10 people. The free plugin runs on hundreds of thousands of WordPress installations, and the Pro version powers backup, migration, and staging workflows for agencies, hosting platforms, and ecommerce stores. I'm still hands-on with the codebase and technical architecture. Our releases are built as a team, but many of the core architectural decisions are ones I helped design, test, and evolve over the years: how we handle large database exports, how we keep memory usage flat on multi-GB sites, and how we make migrations atomic against partially written tables. "When you touch code, leave it 10% better than before and write a test." If you're stuck on a WP STAGING question, the docs are at wp-staging.com/docs. If you hit a bug, file it on GitHub at github.com/wp-staging. Our team reads everything that lands there.