How do I change domains with wordpress plugin cforms installed

August 25, 2011

During development, I always use different domains for development and production.  Typically my deployment process goes like this

  1. Backup development filesystem and move to production
  2. Backup development database and restore on production
  3. Update table wp_options setting option_values for records with option_name siteurl and home to new url
  4. Install find and replace plugin
  5. 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

  1. Deactivate cforms
  2. Backup development filesystem and move to production
  3. Backup development database and restore on production
  4. Update table wp_options setting option_values for records with option_name siteurl and home to new url
  5. Install find and replace plugin
  6. Search for old url and replace with new URI (this updates paths that might be written hard into posts and pages)
  7. Activate cforms

Author

Stay in Touch!

Stay in Touch!
Solutions Architecture

browse through our blog articles

Blog Archive