[wp-hackers] Site Address during development

Jeremy Clarke jer at simianuprising.com
Fri Sep 3 14:51:34 UTC 2010


To summarize the (simplest) plugin that I think would be ideal based on all
this discussion:

   - Offer a way to define a development URL to override the one in the db
   (in conjunction with the wp-config constants)
   - Filter all post data being *saved* to the db to use the original 'live'
   url from the wp_options table
   - Filter all *displayed* post data to str_replace the dev url with the
   live one

Reasons:

   - Ensures that the hardcoded urls in the database will work on live.
   - During dev the two levels of filtering (during save and during display)
   might waste resources but once the site is launched all URLs will work
   without filtering.
   - It basically allows for the hosts file trick but without needing you to
   manage hosts files, I think it could all be done with a plugin.

IMHO this would be a great candidate for a Canonical/Core plugin. Lots of
people need it but having it in core would be very confusing for the
majority of WP users.

A related but simpler system (without a plugin) would be to use the hosts
trick Otto promoted for all content entering, but filter the_content on the
staging site for the people who can't/won't change their hosts config. So
you the dev need to switch your hosts file and so do any important content
editors (assuming there is one or several people rather than the whole org
working on the site before launch), but when passing the staging url around
you run a the_content filter that replaces the live url with the stage one.
Again it has overhead but only during staging and not during actual
production.


-- 
Jeremy Clarke | http://jeremyclarke.org
Code and Design | http://globalvoicesonline.org


More information about the wp-hackers mailing list