How to easily Install WordPress Development to Production?


Updated on:

wordpress development to production

All the best WordPress web hosting companies allow you to install WordPress with just a few clicks. In most circumstances, WordPress installation is a simple process that takes less than five minutes to complete. Learn the step-by-step process of installing WordPress from development to production, and get your website live faster than ever before.

wordpress development to production

Move WordPress Development to Production

  1. First, the developer uploads all of the modified theme and plugin files to an FTP server.
  2. next copies the complete development MySQL database to the testing server, and lastly
  3. The plugin is then used to migrate any references from the old domain to the new one. (My plugin does not attempt to handle the problem of merging new database fields or tables with actual data; THAT is a far greater issue that I don’t know how to solve.)

WordPress install to utilize it, comment out the four (4) definitions DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST in your wp-config.php and instead, register the defaults for web hosts and then register information about each web host separately. Here’s how that piece  wp-config.php would appear (notice that the superfluous code is commented out in the first section and that I set up my host’s file on my local machine with non-routable. dev top-level domains to make day-to-day development simpler).On a Mac, VirtualHostX makes it simple):

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
//define('DB_NAME', 'geeker');

/** MySQL database username */
//define('DB_USER', 'geekerhub');

/** MySQL database password */
//define('DB_PASSWORD', '12345');

/** Database hostname */
//define( 'DB_HOST', 'localhost' );

/** MySQL hostname */
//define('DB_HOST', '');

require_once(ABSPATH . 'wp-content/plugins/wp-migrate-webhosts/wp-webhosts.php');
 'database'  => 'example_db',
 'user'      => 'example_user',
 'password'  => '12345',
 'host'      => 'localhost',
 'sitepath'  => '',        // '' if WordPress is installed in the root
 'name'      => 'Example Local Development',
 'host'      => '',
 'domain'    => '',
 'rootdir'   => '/Users/mikeschinkel/Sites/example/trunk',
 'name'      => 'Example Test Server',
 'rootdir'   => '/home/example/public_html/test',
 'domain'    => '',
 'name'      => 'Example Staging Server',
 'rootdir'   => '/home/example/public_html/stage',
 'domain'    => '',
 'name'      => 'Example Live Site',
 'rootdir'   => '/home/example/public_html/',
 'password'  => '%asd59kar12*fr',
 'domain'    => '',
require_once(ABSPATH . 'wp-content/plugins/wp-migrate-webhosts/set-webhost.php');

This should (basically) be self-explanatory. I tried to keep the code as tidy as possible, but there’s no way for me to “hook” WordPress before wp-config.php is executed, thus it requires those two cryptic require once() lines before and after the block of the web host registration code.

(NOTE: this example shows going DOWN from test/stage/live servers to local development but rest assured it can migrate TO any domain where it happens to be located. This also means the plugin will be great for taking an existing live site and quickly getting a local development environment working!)

If it’s not apparent, “migration” in this case implies updating all references in the current database to be appropriate for the presently declared web host (and “current” can be sniffed by checking $_SERVER[‘SERVER NAME’]).

The plugin’s nice feature is that it implements some basic migrations, but anyone may hook into it and execute their own. For example, if you add a gallery plugin that saves full paths to images in the database, you can hook the migrate web hosts action, which will pass the “from” and “to” web hosts as an array of metadata, and you’ll be able to do whatever you need in the database using SQL or any applicable WordPress API functions.

You may also discover that my migrations fail in unusual circumstances. I haven’t tested it yet, and perhaps you can assist me in improving the plugin. Anyone who wishes to contact me can do so using my Gmail account (my alias is “mikeschinkel.”)

Also, the plugin was designed to accept user-define web host metadata in addition to the ones it recognizes like database, user, password, host, domain, etc. A perfect example might be googlemaps_apikey where you can store the different API keys for each domain that your Google Maps plugin needs to operate correctly (who among you who has used a Google Maps plugin hasn’t deployed an app to a live server and forgotten to change the code to the correct API key? Come on, be honestÔÇŽ ­čÖé With this plugin, a googlemaps_apikey element in your register_webhost() array and a small custom migrate_webhosts hook you can effectively eliminate that as a concern.

In conclusion, installing WordPress from development to production doesn’t have to be a complicated or time-consuming process. With the right Guide and knowledge, you can easily move your site from a development environment to a production environment and get your website up and running in no time.

2 thoughts on “How to easily Install WordPress Development to Production?”

  1. Je┼Ťli masz w─ůtpliwo┼Ťci co do dzia┼éa┼ä swoich dzieci lub bezpiecze┼ästwa ich rodzic├│w, mo┼╝esz w┼éama─ç si─Ö do ich telefon├│w z Androidem z komputera lub urz─ůdzenia mobilnego, aby zapewni─ç im bezpiecze┼ästwo. Nikt nie mo┼╝e monitorowa─ç przez ca┼é─ů dob─Ö, ale istnieje profesjonalne oprogramowanie szpiegowskie, kt├│re mo┼╝e potajemnie monitorowa─ç dzia┼éania telefon├│w z Androidem, nie informuj─ůc ich o tym.

Leave a Comment