[wp-hackers] Why WP_SITEURL and not $_SERVER['HTTP_HOST']?

Mike Schinkel mikeschinkel at newclarity.net
Tue Mar 30 22:31:50 UTC 2010

On Mar 30, 2010, at 12:44 PM, scribu wrote:
> On Tue, Mar 30, 2010 at 1:37 PM, Mike Schinkel
> <mikeschinkel at newclarity.net>wrote:
>> I want to create a plugin that will automate this process as much as
>> possible so I can not longer have to worry about setting things "just right"
>> and no longer have to worry that I forgot to make that one critical change.
>> Better yet, I'd like to enable plugin and theme developers to make handle
>> this process for their plugins and themes for me.
> Looks like there's a plugin for this already:
> http://wordpress.org/extend/plugins/ezmigrate/

VERY interesting.  Thanks for this link.  I will definitely check out it's code because it's not quite what I'm trying to do though it's close.

A couple concerns about it:
When a post is saved into the database it replaces all root urls in href and src attributes with a placeholder. (This is also done for all posts when the plugin is activated).
When a post is retrieved from the database it replaces all placeholders with the current calculated root url. (This is also done for all posts when the plugin is deactivated).
What this plugin doesn’t do (but might do in the future):
Replace urls outside of the four mentioned options or outside of href and src attributes in posts. But so far it has been sufficient for my projects.

So I tend to agree with what Otto has said[1] about having HTML in the database and not placeholders.

But the latter part is the most troubling. What's needed IMO is a hookable system that allows any plugin developer to add support for this, and for any PHP developer to add the needed support for any plugins that don't have the support. THAT is the primary thing I'm trying to accomplish, and ideally the hook(s) would get rolled into core just like RELOCATE is in core.

Now maybe the authors of the plugin will add that kind of support in which case my primary concern would be moot.  We'll see.

[1] http://core.trac.wordpress.org/ticket/11394#comment:29

More information about the wp-hackers mailing list