You are moving your WordPress blog to new server hosted by new web hosting provider. You have decided to move your Domain without changing the Home and Site URLs of your WordPress site. You have followed the simple steps as mentioned below-

1. Restore the DB with same name in new web shot MySQL DB server.

2. Restore the WordPress Blog application files on web host server.

3. Setting new DB user, password and Host details in wp-config.php file under wp-includes folder.

When you tried to access your WordPress Blog, you receive the below shown Fatal Error-

 Fatal error: Cannot redeclare get_site_option() (previously declared in /wp-includes/option.php:28) in wp-includes/option.php on line 135

 

Solution:

To resolve this error you have to use

if ( ! function_exists(‘get_option’) ) {

}

around the function get_option() in functions defined in option.php file under wp-inlcudes folder.

It should look like below-

if ( ! function_exists('get_site_option') ) {
function get_site_option( $option, $default = false, $deprecated = true ) {
	return get_network_option( null, $option, $default );
}
}

 

Function_exists() makes sure you don’t register the same function twice, which will cause an error. You also use if(function_exists(‘function_name’)) when you are calling functions defined in plugins. In case you deactivated your plugin, your site will still be functional.