Annoying WordPress thing…

Published 18 October, 2009 in Misc - 0 Comments

It seems WordPress is hard coding the domain name into the database. How smart is that, or have I missed something? When I first set the site up on my local development server I soon noticed that various links were written hard with the domain and everything. Obviously that would f**k thing up once the site was moved to the public server. So I went into the settings and saw that there were two fields – WordPress address and Blog address – containing absolute paths. So I changed them to relative onces, e.g /blog instead of http://strindberg.loc/blog and things seemed to work properly.

Now I just realized that the guids in the RSS feed pointed to my development server. I looked in the database table and saw that there were hard coded references to http://strindberg.loc. So with a little UPDATE wp_posts SET guid = REPLACE(guid, 'strindberg.loc', 'www.poppa.se') I thought I had solved the problem. But then I realized some other guids in the RSS is generated on the fly, and they get f**ked up since the WordPress address now is relative and thus some guids looks like http:///some-url/. Is that good or what?

And try to figure out how to find out where those guids gets generated. My idea was to find where they are generated and there insert the HOST dynamically, but since there’s a zillion apply_filter(...) it’s virtually impossible to find where the shit gets generated (thanks to Netbeans it’s otherwise simple to follow the chain of execution. Just ctrl+click on a function call and the source of that function will be loaded.)

Ok, so now I have to put on my Sherlock hat and see if I can solve this. I find it hard to believe you shouldn’t be able to move a WordPress site from one domain to another without having to work your ass off!

If anyone have a solution – it’s perfectly possible I’m missing out on something here – I’m happy to know!