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!
Update: If you’ve moved from HTTP to HTTPS, and you’re using WordPress MultiSite, check Craig’s comment below.
Edit your wp-config.php file
You’ll need to access your WordPress files and edit the wp-config.php
file.
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):
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
- 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, like FileZilla or SmartFTP, 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:
update_option('siteurl','http://example.com');
update_option('home','http://example.com');
- 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 security plugins, like iThemes Security, have an option that allows you to disable the File 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:
update_option('siteurl','http://example.com');
update_option('home','http://example.com');
- Save changes.
That’s it!
Conclusion
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!
Thx for the tip.
Good tip. After multiple Google searches I found the answer to the greyed out option in WP panel.
Cheers.
Thank you very much. I was about ready to throw my PC out of the window :)
Thanks for the article. Have moved my site in the past from one host to another (7 years ago) and only recently implemented site-wide SSL. All is working perfectly, but I still have the original problem as outlined here (Home and Site URL are both still
http://
rather thanhttps://
).I removed the two sets of code precisely as outlined here when I did the move last year and have checked again today – that code is definitely absent from the named php files. Still, my fields are grayed out.
The site is under Network Admin installation but all works otherwise perfectly. Is there anything else that could be causing this? Big thanks for your help and for any ideas!
I’ll add that I also edited my .htaccess file when I made the site-wide change to SSL, adding the ‘HTTPS ON’ rewrite module to the top of the page, like so:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !on
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R]
This has worked perfectly. However, several of my pages are failing to show at all, probably because of the above change. This means that when you try to access the page (eg.
https://examplesite.com/examplepage
), it fails to work and just dumps you back to the main page.I’m pretty sure that changing my Site Address to https would resolve this – if only it wasn’t grayed out! Thanks again for any thoughts or ideas, I’m pretty much out of them myself!
I hope this is considered useful info for others finding the site in future, rather than simple spamming of the Comments section! I believe I have worked it out, finding the answer on the WP Codex pages (specifically, https://codex.wordpress.org/Changing_The_Site_URL.
The article began with the same tips as in your post above, but included an Alert! box underneath, which stated: “Alert! These directions are for single installs of WordPress only. If you are using WordPress MultiSite, you will need to manually edit your database.”
Ah ha!
Scrolling down, I found this:
If you know how to access phpMyAdmin on your host, then you can edit these values directly.
1 .Backup your database and save the copy off-site.
2. Login to phpMyAdmin.
3. Click the link to your Databases.
4. A list of your databases will appear. Choose the one that is your WordPress database.
5. All the tables in your database will appear on the screen.
6. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
7. Click on the small icon indicated as Browse.
8. A screen will open with a list of the fields within the wp_options table.
9. Under the field option_name, scroll down and look for siteurl.
10. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
11. The Edit Field window will appear.
12. In the input box for option_value, carefully change the URL information to the new address.
13. Verify this is correct and click Go to save the information.
14. You should be returned to your wp_options table.
15. Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
16. In the input box for option_value, carefully change the URL information to the new address.
17. Verify this is correct and click Go to save the information.
–
I backed up my databases locally and gave it a shot, changing both siteurl and home options from http to https.
It worked! Woohoo! Sharing here for the reference of others who use MultiSite WordPress and have moved from http to https. Finally sorted! Thanks again for your part in my journey :)
Hello! I’m happy that you worked it out and thanks for the info! I’ll also write a post how to properly move from HTTP to HTTPS.
Thank you so much! ;-)
Simply wonderful, you saved my life…!
Thank you for the article, was a life saver for me.
Thank you! A straightforward explanation. It worked perfectly.
I found “define(‘WP_HOME’,’http://example.com’); define(‘WP_SITEURL’,’http://example.com’);” lines on wp-config.php file, so I deleted, but I can’t still change the wordpress address. I checked functions.php file, but I coudn’t find those line.
I’m having the same problem. The update_options lines are nowhere to be found in the functions.php file. I’m using Ocean WP theme.
I have looked tirelessly for a solution to this problem, and finally I stumbled across your site! Thank you so much!
Thanks for this post! Saved me some heartache. Worked like a charm.
Hi, i tried the wp-config.php process and it seems not to work, please what should i do, has anyone done it properly?
Hello! Looked into your functions.php too? If yes, then the only thing I can think of are your plugins. Disable them and see if the issue goes away.
Craig V’s suggestion saved me having to hunt around for the database table to edit. I hadn’t scrolled down on the Codex page to see the instructions! Thank you.
Awesome! Happy to see you managed to sort it out!
Only use update_option once. After delete this code. If not, each visit will create an update query.
Thanks for mentioning this!
SO, my Mixed Content message was not related to this file. It was realted to fact that I had chosen my theme image files with the direct IP address, s the link was somewhere in there . I had to remove several image files andmerely re-add them