While creating this blog, I was messing around with the General settings in the WordPress admin control panel. Little did I know that in doing so, I would be locked out of my site! After searching online for possible remedies, I found one solution that worked for me. I thought I would share it in case someone finds themselves in this situation!

To succeed with this method, you will need access to your domain file management, usually through your hosting provider. You will also need to know the current active theme for your WordPress site. Once you access the file management on your domain, go to the directory for your active theme and find the functions.php file.

You then need to edit this file (functions.php) and add the following lines of code just after the <?php at the start.

update_option ( ‘siteurl’ , ‘http://example.com’ );

update_option (‘home’ , ‘http://example.com’ );

Where example.com is your URL. See below image to clarify:

Save the changes and try access your site’s WordPress admin section, it should now allow you to log in. Now that it is working, you need to go back into the functions.php file and remove the two lines of code because if you leave them there, they can pose a security vulnerability to your site. Please ensure you do this straight away, you have been warned.

Hope this article summarised one of the ways to regain access to your WordPress site if you messed up the URL settings. For more information refer to the WordPress website support section.