DavidError After Changing URLs in WordPress General Settings

Recently, a client decided to purchase an alternative domain name for their existing website. They decided to log into their WordPress dashboard and start poking around. They changed the WordPress Address and Site Address under General Settings to the new domain name. Needless to say, this wasn’t a good idea. After the changes were saved, the website was no longer functioning.

wordpress-general-settings

The site wasn’t displaying and I couldn’t access the WordPress login to get to the dashboard. In order to correct the issue, I needed FTP access so I could modify the wp-config.php and functions.php file.

The following code can be used to manually define a website URL through the wp-config.php file.

define('WP_HOME','http://www.yourdomain.com');
define('WP_SITEURL','http://www.yourdomain.com');

Within seconds the website was working.

However, I was faced with another issue. When I logged in to WordPress and went back to the General Settings, the text fields were disabled.

wordpress-general-settings2

In order to edit these fields, I added the following code to the top of the functions.php file, immediately after the initial “<?php” line.

update_option('siteurl','http://www.yourdomain.com');
update_option('home','http://www.yourdomain.com');

After I uploaded the new version of the functions.php file, I removed the code that was added to the wp-config.php file.

When I logged back into WordPress, the text fields under General Settings were editable.

The last step was to remove the code that I added to the functions.php file and the issue was solved.

Check out my previous post, which will show you how to use your .htaccess file to redirect an alternative domain.


Comments? Let us know your thoughts.

5 Responses to Error After Changing URLs in WordPress General Settings

  1. Silviu
    1:00 am on May 11th, 2015

    Done this and it’s not working. Tried both wp-config and functions.php method.

  2. Error After Changing URLs in WordPress General Settings – My Blog
    11:22 pm on July 23rd, 2017

    […] Error After Changing URLs in WordPress General Settings […]

  3. ibrahim
    5:47 am on August 3rd, 2017

    tried it out….wp-config change worked perfectly, but the functions.php change did not work….received everytime an error.

  4. Jonthan
    4:36 am on December 30th, 2017

    This is actually accurate except for one point, you should have mentioned that the functions.php file to be edited is not the one in wp-include but the one found in our current themes folder.
    https://www.tipsandtricks-hq.com/how-to-change-the-url-of-a-wordpress-site-6098

  5. Santosa Sandy
    1:32 am on January 31st, 2018

    I am fixing that problem by editing the site url in the sql database as suggested here https://www.digitalocean.com/community/questions/500-internal-server-error-after-changing-wordpress-url

Leave a Reply

Your email address will not be published. Required fields are marked *

*

 


Search

Our Newsletter

About Us

PaperStreet is a law firm web design and attorney internet marketing company, and provides law firm SEO. We create websites for lawyers that impress and get results. Founded by a lawyer, for lawyers, we have helped over 1,300+ law firms since 2001.



Free Website Analysis & Consultation. Contact Us Today