Worcester Web Group Blog

Trying something with HTML

Let’s test something with HTML

Right below here

Your CTA Title

A short description of what something is. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur temporibus quis, at facilis deserunt! Accusamus nulla aut a repellat, officiis harum, non maxime eaque dignissimos quos adipisci illum tempore debitis!

Learn more

JSON Decoding Failure in WordPress Migrate DB Pro

On two client websites I had recently run into an error that I couldn’t get to the bottom of with WordPress Migrate DB Pro.

JSON Decoding Failure — Our AJAX request was expecting JSON but we received something else. Often this is caused by your theme and/or plugins spitting out PHP errors. If you can edit the theme or plugins causing the errors, you should be able to fix them up, but if not, you can set WP_DEBUG to false in wp-config.php to disable errors from showing up. (#144)

ajax_migrate_table was expecting a valid numeric but got something else: “{“wpmdb_error”:1″

This message appeared immediately (or within the first 5 seconds) of a migrate, preventing me from pushing or pulling from remote, stage, and local.  The error normally appears when there is a blocking issue with a plugin, but even removing plugins using WPMDB’s compatibility mode did not solve the issue.  I had also tried deactivating themes thinking that could be part of the problem, even though my activated themes did not have any errors.

Turns out the issue is with incompatible versions of MySQL where one environment will support utf8mb4 encoding and the other does not.  Normally, this would give you a more descriptive error, but for whatever reason, there is a bug with WPMigrateDB Pro 1.5.1 that prevents the helpful error from displaying and gives you that unhelpful error above.  If you do have this error, you should update your instance of MySQL to the latest to ensure that both remote/stage and local support utf8mb4 encoding.  If you do not have access to update MySQL or maybe it’s not your specialty, there is a patch for WP Migrate DB that does the trick.

Thankfully, the Jeff from Delicious Brains shared a patch for getting around this error that should get you by until an update for the plugin is out or you can fix your instance of MySQL.  The patch has been added to his gists page in github.  If you have experience creating wordpress plugins, jump right in and install this, but if not, it shouldn’t take long if you follow the instructions below.

Instructions for installing:

  1. On the Gists page click “Raw,” and copy out the raw code.
  2. Open a text editor (SublimeText, TextMate, or even Notepad will do) and paste the contents of the raw gist into this file.
  3. Go to File -> Save, and save this file as something like wp-migrate-db-pro-tweaks.php
  4. Connect to your server using FTP, and navigate to your /wp-content/plugins/ directory.
  5. Create a new folder called “wp-migrate-db-pro-tweaks” and then upload the file you just created, wp-migrate-db-pro-tweaks.php, into this directory
  6. Now go to your website’s Admin panel, navigate to the Plugins page, and you should see this new plugin appear in your plugins list.  Click “Activate”

Once activated, your migrations should start working again.

The PHP file here has a lot of tweaks that may be absorbed into a full future release of WP Migrate DB Pro, so if you’d like to just focus on the tweak that resolves with uft8mb4 encoding issue, you can use this snippet alone:

 * By default WP Migrate DB Pro will abort an attempt to go from utf8mb4 to utf8 in case of data loss.
 * Return false for the wpmdb_abort_utf8mb4_to_utf8 filter to override this.
 * @see https://deliciousbrains.com/wp-migrate-db-pro/doc/source-site-supports-utf8mb4/
 * @param bool $abort_utf8mb4_to_utf8
 * @return bool
 function abort_utf8mb4_to_utf8( $abort_utf8mb4_to_utf8 ) {
 return false;

Drop a comment if you have any issues.