So, I had an idea. But there are some issues, and I’m hoping someone can help out with that.
If there are nop other ways to do what I need, perhaps I can lift the domain name (i.e. http://wpdev.com/) from my ENVIRONMENT file (in my framework every serving directory has an ENVIRONMENT file which specifies certain configuration settings. These files do not go in the repository, and must be configured on each server, and in each directory.)
Then I can tweak the bloginfo(‘url’) function to return the ENV domain name rather than the one from the DB.
The problem comes when we want to update WP. These changes will get creamed by the update.
So come on, is there another way to do this?
Thx for your help.
– AAA
Why not just dump the database and do a search/replace on the domain name when you are ready to move it to a different server? See this for more info:
http://educhalk.org/blog/?p=50
In the config files of your test servers, add the WP_HOME and WP_SITEURL defines. These will then override the database settings for those sites.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com/blog');
That sort of thing.
Thx for the responses guys. I’ve been doing some Codex diving and it’s looking like the filters might be just what I’m looking for. If anyone has suggestions on this, I’d be grateful for some direction.
I think the bloginfo_url filter is what I need for this. I’m wondering: do I have to create a plugin to use this, or can I use it from my theme?
Read my response again before you go using a filter. Really. 😉
Thanks for you post Otto42. That solved the problem beautifully.
I found that I had to make sure that WP_SITEURL was defined. Setting WP_HOME was not enough, as WordPress still grabbed the siteurl option from the DB unless I explicitly defined WP_SITEURL.
Otto42: My apologies. I tried your solution and it worked like a charm! All links are based on my local domain.
Thanks!!
BTW, where is this documented?
Many of the possible defines are listed here:
http://codex.ww.wp.xz.cn/Editing_wp-config.php