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

TL;DR: The Yoast SEO "Something has gone wrong" error fires when Yoast’s background SEO-data rebuild fails — most often due to a JavaScript conflict or stale database records in the indexables table. Resetting Yoast’s indexed-data tables and rerunning the optimizer resolves the error in the majority of cases. If the problem persists, the root cause is almost always a plugin conflict interfering with WordPress REST API requests.

After installing Yoast 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.

Why Does This Error Happen?

Yoast SEO stores per-post SEO metadata — titles, meta descriptions, Open Graph data, internal link counts, and breadcrumb information — in the wp_postmeta table and a set of custom indexables tables in your WordPress database. When you click "Start SEO data optimization" in Yoast SEO → Tools → Data Optimization, Yoast triggers a background REST API queue to rebuild all of this data.

The "something has gone wrong" error fires when that rebuild queue stalls. In WP STAGING support tickets, the most common triggers we see are:

  • A JavaScript conflict — another plugin or theme enqueues a script that throws an error in the WordPress admin, breaking Yoast’s async queue before it completes.
  • A PHP memory limit hit — sites with many posts can exhaust the PHP memory limit mid-rebuild; the queue times out and reports failure.
  • A stale or corrupted indexables table — a previous partial rebuild left the database in an inconsistent state that Yoast cannot continue from.
  • A non-standard permalink structure — some permalink configurations cause REST API routing issues that prevent Yoast’s internal requests from completing.

From our testing, a simple reset of the indexables tables clears the stale state in most cases, and the rerun completes without further intervention.

Quick Triage: Which Fix to Try First

Situation Start here
Error on one post only Skip the reset — go straight to Rerun SEO Data Optimization for that URL
Error on all posts Reset the indexables tables (see below), then rerun optimization
Error persists after reset Disable all other plugins, rerun, then re-enable one by one to isolate the conflict
Error persists with all plugins disabled Check the browser console for JavaScript errors (see Debug JavaScript Errors below)
None of the above resolves it See What to Do if None of the Fixes Work below

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.

What to Do if None of the Fixes Work

If the reset-and-rerun cycle and JavaScript debugging have not resolved the error, the following approaches address the most common edge cases from WP STAGING support tickets.

Run the Optimization via WP-CLI

The WordPress admin optimization runs through a browser-initiated REST API loop, which can time out on large sites. Running the same process via WP-CLI bypasses the browser entirely:

wp yoast index

Run this command via SSH or your hosting control panel’s terminal. It processes posts in batches server-side and is significantly more reliable on sites with a large number of posts.

Increase the PHP Memory Limit

If the optimization consistently fails mid-run, a PHP memory limit hit may be interrupting the process. Add the following to your wp-config.php above the /* That's all, stop editing! */ line:

define( 'WP_MEMORY_LIMIT', '256M' ); /* adjust the value per your hosting plan's available memory */

After saving, retry the optimization from Yoast SEO → Tools → Data Optimization.

Check Whether a Security Plugin Is Blocking REST Requests

Some security and firewall plugins block the internal REST API requests that Yoast’s optimization queue relies on. To test whether this is the cause:

  1. Temporarily deactivate your security plugin.
  2. Retry the optimization from Yoast SEO → Tools → Data Optimization.
  3. If it succeeds, re-enable the security plugin and whitelist Yoast’s REST API requests in the plugin’s settings.

Contact Yoast Support

If none of the above resolves the error, contact Yoast support directly. When you reach out, include:

  • A screenshot of the exact error message and any visible error code.
  • The browser console log (see the Debug JavaScript Errors section above).
  • Your WordPress version, Yoast SEO version, and a list of active plugins.

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

Rene Hermenau

Author: Rene Hermenau

About the author: René Hermenau is the founder of WP STAGING. He works on WordPress backups, staging, migrations, database handling, and safe deployment workflows.