WordPress site URL during staging

Wordpress Logo

It is often useful to have a development and a staging environment alongside a production WordPress installation. Whilst staging it can be also be helpful to hook into the regular production database prior to switching the site live just to make sure there are no suprises ahead.
Because WordPress defines the site URL used for generating all links from a database entry, placing the below declarations into your wp-config.php file can quickly allow you to do this (without having to use a preview theme) Obviously replace stagingurl with your own address!

define('WP_HOME','http://stagingurl.com');
define('WP_SITEURL','http://stagingurl.com');

Some background reading in the WordPress codex is here