$_SERVER[‘SERVER_NAME’] in WP_SITEURL

Personally, I make them default to the HTTP host:

define('WP_HOME',     'http://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL',  'http://' . $_SERVER['HTTP_HOST']);

There are no caveats for single WP installs. It’s in fact very convenient when testing changes in a dev.example.com subdomain, in the sense that it allows to use the same database before rolling out a change on a live site.

Don’t do this in multisite installs, however — especially you plan want domain mapping. 🙂

error code: 523