[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.

Gavin 


-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Jeremy
Clarke
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
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
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list