[wp-hackers] change siteurl at DB level
Christopher Bratlien
chrisbratlien at gmail.com
Tue Aug 24 20:33:06 UTC 2010
You might be interested in a plugin I wrote for exactly the same situation.
http://wordpress.org/extend/plugins/relative-site-url-on-content-save/
It doesn't do any replacing upon installation, though. Only on clicking
Update or Publish
On Tue, Aug 24, 2010 at 3:18 PM, Andrew Gray <andrew at graymerica.com> wrote:
> I have been trying to move a site from development.domain.com to
> domain.com all day and got fed up and wrote some SQL to make the change on
> the DB level.
> I know that you can download the DB dump and fix it, but it causes some
> problems for me with UTF characters. Also some of my sites are pretty big
> now, with all the revisions, custom post types and what not.
>
> If you run this command, you can pretty much change all of the stock
> tables.
>
> This will not change all your plugins values, but saved me a ton of time.
> Took about 1 sec to run
>
>
> #Change Domain in in Wordpress DB
> #before you run this command in SQL (phpmyadmin)
> # 1. Backup DB
> # 2. Find and replace the text below in your text editor
> #replace $old$ with the old domain name
> #replace $new$ with the new domain name
>
> update wp_postmeta set meta_value = replace(meta_value, '$old$' , '$new$')
> ;
> update wp_posts set post_content = replace(post_content, '$old$' , '$new$')
> ;
> update wp_options set option_value = replace(option_value, '$old$' ,
> '$new$') ;
>
> #end sql command
>
> I would love it if there was an easy way to force wordpress to use a place
> holder for the domain and then replace in the correct one when it reads from
> the DB.
> If I could find a filter that would filter every value from read and write
> to the db, I could do this very easy, but there is no filter for every value
> coming from the DB.
> I just do not know why the SITEURL should be stored in the DB. Is there a
> pair of filters that I can use to replace a value in every read and write
>
> Andrew
> _______________________________________________
> 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