We recently had a client who has implemented an SSL certificate for his website, but he didn’t know how to perform a proper redirection from HTTP to HTTPS, so he asked for our help.
While working on it, we noticed that the Site Address (URL) and WordPress Address (URL), found in General -> Settings, were grayed out, therefore they couldn’t be changed. This usually happens when someone moves a WordPress site, but forgets to delete a couple of lines of code.
So, in this article, we’ll show you what file you need to edit in order to be able to change your Site Address and WordPress Address from within the General settings. It’s easy, don’t worry!
Edit your wp-config.php file
This is the first place to look for the code that needs to be removed.
Backup your wp-config.php file in case something goes wrong! Just download it somewhere on your hard drive.Backup your wp-config.php file in case something goes wrong! Just download it somewhere on your hard drive.
For our example, we’ll use cPanel. What you need to do is to:
- Log in to cPanel and open your File Manager;
- Select public_html;
- On the right, find the wp-config.php file. Once you’ve found it, right-click on it and select Edit;
- Now search for these lines of code and delete them (if they are there, of course):
- Save changes.
You’ll find your site’s URL there, of course, not “example.com”.
To quickly find them, just press Ctrl+F (Command+F on Mac) and insert a piece o code (e.g.
define('WP_HOME)) and hit Enter. That will send you directly to the code.
After you delete that code, your Site Address (URL) and WordPress Address (URL) shouldn’t be grayed out anymore, and you can edit them.
If the code is not there, check the functions.php file!
Edit your functions.php file
You can edit your functions.php file through cPanel, a third party software mentioned above, or the WordPress Editor. We’ll use cPanel and the Editor for our examples.Backup your functions.php file in case something goes wrong! Save it somewhere on your hard drive.
1. Through cPanel
- Access the File Manager as in the above example;
- Go to public_html -> wp-content -> themes -> select your theme’s folder;
- Once you’ve selected your theme’s folder, search for functions.php on the right, right-click on it and select Edit – the same process as above;
- Now search for these lines of code and delete them:
- Save changes.
You can always use the Ctrl+F (Command+F on Mac) command to quickly find them, as I mentioned above.
2. Through WordPress Editor
You can find this feature inside your WordPress Dashboard.
This feature might be unavailable for security reasons. Some plugins, like iThemes Security, have an option that doesn’t allow you to edit files using the Editor.
In order to access this feature, you need to:
- Go to Appearance -> Editor;
- Once there, search for Theme Options (functions.php) on the right and click on it;
- Now search for the lines of code and delete them:
- Save changes.
Be careful when you change your Site Address and/or WordPress Address, because it can affect your website. Also, be careful when you edit those files I’ve mentioned. Don’t forget to back them up!
If you’re not sure what you are doing, please ask someone with more experience to help you! Better safe than sorry, no?
If you have any thoughts to share with us, or you want to ask us something, please leave a comment!