T-Rex T-Rex - 1 year ago 52
PHP Question

What is best practice to config when changing host in wordpress?

I develop my Wordpress site from the localhost, name: http://moingaytoisong.dev
My real website is : http://moingaytoisong.com
Every time I pull the database from the live site to my local site, I need to search and change the url in wp_options table. It's quite frustrate.
Do you have any better idea?

Answer Source

In your wp-config.php, just need to add these lines below:


It will overwrite the url in database, so no need to change the url in wp_options anymore. Your local website and your live website can use the same database without any issue