1

If possible, how would I go about disabling plugins using the Find and Replace options the Migrate DB plugin offers?

What I hope to achieve

I use Migrate DB to bring copies of production DBs down to local dev environments. There are a couple of plugins I use which I consider to be "production only", such as W3 Total Cache, and UpdraftPlus, which I don't want to be activated in my dev environment.

Migrate DB offers a find and replace function that changes the URL and file paths saved in the DB during migration. You can add additional custom find and replace queries to be run during migration, and I use this option to change the destination email address for things like contact forms to avoid sending emails during testing and causing confusion.

So, Is there a find and replace query that can be run to disable plugins during migration?

1

To disable plugins using the find and replace option in Migrate DB, search for the file path to the plugins main PHP file, and replace it with nothing.

To disable W3 Total Cache for example, you would search for w3-total-cache/w3-total-cache.php and leave the replace field empty.

Explanation

WordPress stores the active plugin data in the active_plugins record within the wp_options table as a serialised string. The Migrate DB plugin is smart enough to know it is performing a find and replace on a serialised string and will unserialise it, run the find and replace, and reserialise the string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.