WordPress: How To Update Site URL And Home URL Using SQL

I do this often enough. You think it’d be committed to memory by now. Alas, my memory doesn’t need to be bothered with things like this. That’s what my blog is for. So here blog, remember this.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';

I also, like the safe version of this, you know, just to see what is already in there. Or what you updated it with.

select * from wp_options WHERE option_name = 'home' OR option_name = 'siteurl';

Thanks to this article for the reminder. I have found myself there a few times.

Posted in: Development  |  Tagged with: , , ,  |  Leave a comment

Leave a Reply