How do I change domains with wordpress plugin cforms installed
During development, I always use different domains for development and production. Typically my deployment process goes like this
- Backup development filesystem and move to production
- Backup development database and restore on production
- Update table wp_options setting option_values for records with option_name siteurl and home to new url
- Install find and replace plugin
- Search for old url and replace with new URI (this updates paths that might be written hard into posts and pages)
I’d never used the cforms plugin before but was brought into the middle of a project using it and upon deploying to production, it stopped working. After some digging, I found out that cforms had cached the development URI in two places in its settings:
- cforms_root
- tinyURI
My initial thought was just to update these values, but the serialized data was getting corrupted after updates. So, I dug a little deeper into where the URI was being set. I found it in lib_activate.php lines 8 and 9 (and saved via update_options() on line 184). Realizing this was running during plugin activation, I deactivated the plugin, then activated it again and it corrected the URI issue.
In the future, if using cforms, my migration process will be
- Deactivate cforms
- Backup development filesystem and move to production
- Backup development database and restore on production
- Update table wp_options setting option_values for records with option_name siteurl and home to new url
- Install find and replace plugin
- Search for old url and replace with new URI (this updates paths that might be written hard into posts and pages)
- Activate cforms