Saturday, 8 February 2014

A PHP script to aid migration and other aspects of a Wordpress install.

Wordpress has without doubt made a huge mark on the world of blogging and content management in general, and although its framework coding concepts are really quite outdated (which could well take up the content of another blog article entirely), it doesn't show many signs of disappearing anytime soon.

One of the issues that always causes me headaches though, is the problem that crops up from migration from development to production. Wordpress doesn't seem to have a grasp of how to handle this, and the result is database tables that are riddled with wrong domain or path information. Some of this wrong data is also often embedded inside serialized arrays or objects which again, compounds any simple 'find and change' technique.

There are a few scripts out by developers (which I am pleased to see) that try to bridge this issue and allow for deep searching and replacing. To me though, these scripts seemed a little complicated, and I wanted something that, for example, already knew database details because it could leverage them directly from Wordpress itself.

So, I wrote this. Its a simple single page script with a little security that can be uploaded to a host and gives an authenticated user the ability to do a simple find and replace irrespective of database field data format. It uses the Wordpress database configuration as well as CSS styles to allow for a clearer user interface.

It can be downloaded from GitHub here.