Do you need to fix your WordPress site after changing the WordPress Address (URL) and Site Address (URL). You may find that your site will not load the CSS, JavaScript and images.
The worst part is that you may won’t be able to access your site Administrator Dashboard and Settings making it unable to revert the changes you have just made. In this article we will show you how to change these WordPress URL and Site URL directly.
Before we get started, please note the following important points
- These changes will work for single installs of WordPress only. It will not work on MultiSite WordPress.
- siteurl is WordPress Site URL and home is Site Address URL
- In both of the value i.e. siteurl and home, you should include the http:// at the beginning of the URL and should not have a slash(/) at the end
- Replace www.DigitalOrgano.com with your URL
Hope that you have noted the above points , so let’s get started. Any of the below steps will work, you may choose the one which is best suited for you.
Using The wp-config.php
In this steps, you have to edit your site wp-config.php and add the following two lines of code.
define('WP_HOME','https://www.digitalorgano.com'); define('WP_SITEURL','https://www.digitalorgano.com');
This fix is not recommended as you won’t be able to change it using General setting.
Editing The Theme’s function.php File
Edit your theme’s function.php file and add the these two lines of code just after the <?php line and try to refresh and login to your site
update_option('siteurl','https://www.digitalorgano.com'); update_option('home','https://www.digitalorgano.com');
Important: Remember to remove the above two lines immediately after your site is working
Make Changes From Database
We highly recommended that you backup your site database before proceed this step
You can fix your site URL by login to phpmyadmin and executing the below SQL queries.
UPDATE wp_options SET option_value='https://www.digitalorgano.com' WHERE option_name='siteurl'; UPDATE wp_options SET option_value='https://www.digitalorgano.com' WHERE option_name='home';
NOTE: You may need to change the wp_ prefix if you change the default WordPress database prefix.
Upload A PHP File
Last but not the least, you can create a new php file and name it something like changeurl.php and paste the below php code
<?php require( dirname(__FILE__) . '/wp-load.php' );//Do not remove this else it won't work //Replace www.example.com with your site URL $siteurl = 'https://www.digitalorgano.com'; //WordPress Address (URL) $homeurl = 'https://www.digitalorgano.com'; //Site Address (URL) //Do Not Change Any Code Below update_option( 'siteurl' , $siteurl ); update_option( 'home' , $homeurl); if (get_option('siteurl') == $siteurl){ echo 'Site URL has been updated to ' . $siteurl . '</br>'; } else{ echo 'Site URL has <strong>not</strong> been updated to ' . $siteurl . '</br>'; } if (get_option('home') == $homeurl){ echo 'Home URL has been updated to ' . $homeurl . '</br>'; } else { echo 'Home URL has <strong>not</strong> been updated to ' . $homeurl . '</br>'; } ?>
Upload the above file to your site root directory and try to access it using your browser.
Example URL: https://www.digitalorgano.com/changeurl.php
IMPORTANT: Delete the above file after your site is up and running.
We hope that this article has helped you in fixing your WordPress site URL and get your site up and running again. If you have any questions, suggestion or noticed something is missing. Please feel free to leave us a comment below.