[wp-hackers] Wordpress in Multiple Environments

Mike Schinkel mikeschinkel at newclarity.net
Mon Jan 17 01:30:07 UTC 2011

On Jan 16, 2011, at 8:07 PM, Andrew Nacin wrote:
> The simplest solution is to run an output buffer in staging that rewrites
> any live links. Works extremely well and doesn't put any additional burden
> onto the production site. It also helps in a number of other areas outside
> the media library. You might want to conditionally filter the uploads stuff
> anyway the same way you're filtering home and siteurl.
> It could literally be as simple as this in wp-config.php:
> ob_start( 'mysite_staging_links' );
> function mysite_staging_links( $content ) {
>   return str_replace( 'http://mysite.com/', 'http://staging.mysite.com',
> $content );
> }

How does that address the URLs saved to the database by images uploaded when in the staging environment? 


More information about the wp-hackers mailing list