WordPress Local And Live Site

My best practice to run a production system and keep a development version with a simple and easy configuration. Notice: This works super awesome on small wordpress websites.

  • Create production and development configuration files:

    • wp-config-dev.php (contains local database configuration, site url and debugging)
    • _wp-config-live.php (contains production database config., live site url and disabled debugging configuration)
    • Modify wp-config.php:

    // Insert before: require_once(ABSPATH . 'wp-settings.php');
    /** Production server configuration */
    if(file_exists(ABSPATH . 'wp-config-live.php')) {
    include_once(ABSPATH . 'wp-config-live.php');
    }
    /** Development server configuration */
    else if(file_exists(ABSPATH . 'wp-config-dev.php')) {
    include_once(ABSPATH . 'wp-config-dev.php');
    }

  • Keep the whole development wordpress site under version control (except for wp-content/upgrade/, wp-content/uploads and wp-config-live.php).
  • If I need to import the production website data into the development system I download the whole wp-content/uploads directory and the whole database dump. In the database dump I usually replace the production site url with the development site url.