What you posted will work fine for all links that are generated by WordPress: permalinks, script/style enqueues for local files, featured images, etc.
I tend to define my Site URL and Home URL dynamically like this:
<?php
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', WP_HOME . '/wp');
Note: HTTP_HOST isn’t always present, use with caution
As far as in content, links and urls — things like links to other posts or links to images, those will not get changed as they are just in the database, not generated dynamically. You can probably do some preg_replace
magic with the the_content
filter, however.
<?php
// probably too simplistic and will break things.
add_filter('the_content', 'wpse75106_change_host');
function wpse75106_change_host($c)
{
return preg_replace(
'#(https?://)production_site.com#u',
'{$1}local_site.com',
$c
);
}
That said, the important things are the stuff WP generates, I wouldn’t worry too much about in content links/images on your local machine.