Creating a Staging Environment for Your WordPress Installation
For yesterday’s attempt to cleanup my database and fix the post id > 2³¹-1 issue I did not just want to fire the scripts and tests at my live site. So I quickly set up a WordPress staging environment. In my case, I created a special subdomain on my server, which makes things fairly easy. If you can do that as well: great, read on. If not: go check out Moving WordPress. They described how to move your site for a few more different scenarios.
Back to my situation. First log in to your server and create a new directory for the staging environment and copy all the content from your original WordPress directory to that new location. Then head over to your database management system and export your WP database. You should make the export file be able to create the tables. Import that export file into a new database. While being here on the database server open up the wp_options
table and alter values for siteurl
and home
. Set them to your new subdomain. Of course, if you did not create that one yet, go and do that now. Then jump back three sentences. Last but not least you’ve got to tell the wp-config.php
the new database name.
For me that was all I needed to do to have a save environment to play around with. Hope that helps.