Accidentally Changed the WordPress Site Address?

website design and website development

I came across this solution recently when I was experimenting with some settings. I have a number of my own websites for this purpose so don’t worry  – I don”t do the experiments on my clients websites!

The solution is in a blog from 2010.
I want to keep a record of various sites and fixes that I come across so I’m going to put the solution here. I’m sure it will be of help to someone else too.

If you have accidentally changed the WordPress Site address in General Settings and now cannot access your site, this post is for you.

Inspired by this Smashing post, What Is The Worst Design or Programming Mistake You’ve Ever Made?, I decided to share mine and hope that this post can be my “Iceberg, dead ahead!” cry.

Setup: I was working on a new client site. I had a development site going in one tab and their live site in another. Problem was that the WordPress backends looked almost identical.

I thought I was changing the WordPress site address on my dev build but I was on the live one. Eek!

When I changed this address WordPress thought it lived elsewhere. The only way I knew at the time to fix this was to use PHPmyAdmin to muddle through the database and find that field and change it back.

I felt a shock of terror run through me as I just took a live and very public site offline and it was now redirecting to my website and the dev subdirectory I was using. I eventually got PHPmyAdmin access and changed it but I have since learned a trick that only requires your being able to edit WordPress’s wp-config.php file

There’s a fix!

Using FTP, open up the wp-config.php file found in the root of your website files, edit it with a notepad program. Here is what the file will look like in FTP:

screengrab-2fix

wordpress-config-file-ftp
and paste these lines (with your site name) into it after the initial commenting:

define(‘WP_HOME’, ‘http://sitename.com’);
define(‘WP_SITEURL’, ‘http://sitename.com’);
(Taken from my beautiful WordPress code snippets list)
When you do this, the fields for this in the WordPress backend will be uneditable and grayed out. This is a good idea if you are passing a site off to a client who will have full admin access. This will prevent them from accidentally changing this very important WordPress option.

screengrab-fix

EDIT: It appears there is also a way to do this with the functions.php file if you have access to that and not wp-config.php

 

link to original: https://www.blakeimeson.com/accidentally-changed-wordpress-site-address/

CONTACT ME

I am not around right now. But you can send me an email and I'll get back to you, asap.

Sending

©2019 Smiling Spiders Website Design, Maintenance, SEO, Support & Training

Log in with your credentials

Forgot your details?