i have shifted my wordpress site from domain to another through php.But when i try to change the home and siteurl options, i get failed.So is there any way that i can change my "home" and "siteurl" options through php instead of changing manually by going to phpmyadmin. Now i am trying to change the options like this.
update_option('home',get_site_url());
update_option('siteurl',get_site_url());
You need to hardcode the values when using update_option
since the value of get_site_url()
will be the current value (so your code doesn't change anything).
$site_url = 'https://www.yoursite.com/'; // set to your site's home
update_option( 'home', $site_url );
update_option( 'siteurl', $site_url );