Removing Old Transients

The WordPress transients are cache-type information that are saved into the database if the Redis object cache or something similar is not in use. it is recommended to remove the old transients when transferring the site because it is often necessary to have the cache rebuilt on the new server.

From a database dump you can remove transients as follows:

sed -r '/INSERT INTO `wp_options` VALUES \([0-9]+,'\''_transient_/d' -i dump.sql
sed -r '/INSERT INTO `wp_options` VALUES \([0-9]+,'\''_site_transient_/d' -i dump.sql

From database that is being used you can remove them as explained below:

$ mysql
MariaDB > DELETE FROM wp_options WHERE option_name LIKE ('_transient_%');
Query OK, 69 rows affected (0.01 sec)

MariaDB > DELETE FROM wp_options WHERE option_name LIKE ('_site_transient_%');
Query OK, 29 rows affected (0.01 sec)

We do not recommend the command wp transient delete-all when transferring the site. Direct database command will always be targeted to the database even though object cache would be in use and it works even though WordPress itself is be broken and does not need the wp-cli to run.

Depending of the way you are transferring the site the files may not include the object-cache.php.offmentioned in the Object Cache -article. In such situations the installation can be done using the following commands:

cd /data/wordpress/htdocs/wp-content
curl -O https://raw.githubusercontent.com/Seravo/wordpress/master/htdocs/wp-content/object-cache.php

Did this solve your problem?