[wp-hackers] Site Address during development

Gavin Pearce Gavin.Pearce at 3seven9.com
Fri Sep 3 15:09:14 UTC 2010

I think plugin/filters are the wrong way to fix an issue, rather the
issue should be solved at its source:

I agree fully with Bjorn on this:

> Inserting data into a database with absolute urls seems a bad idea,
for at least two reasons:

> - Hard to change
> - Repeats (unnecessary) data all over the database

I would also add, the database content should "not" be tied to a
particular domain, and should just be content. Domains are, more often
than not, not relevant to the content.


-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Jeremy
Sent: 03 September 2010 15:52
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Site Address during development

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

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


   - Ensures that the hardcoded urls in the database will work on live.
   - During dev the two levels of filtering (during save and during
   might waste resources but once the site is launched all URLs will
   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
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
trick Otto promoted for all content entering, but filter the_content on
staging site for the people who can't/won't change their hosts config.
you the dev need to switch your hosts file and so do any important
editors (assuming there is one or several people rather than the whole
working on the site before launch), but when passing the staging url
you run a the_content filter that replaces the live url with the stage
Again it has overhead but only during staging and not during actual

Jeremy Clarke | http://jeremyclarke.org
Code and Design | http://globalvoicesonline.org
wp-hackers mailing list
wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list