How to change WordPress URL

How to change WordPress URL - CodeFlist

Have you seen WordPress address URL greyed out? If you have, then you need to learn how to change WordPress URL. 

Causes of “Wordpress address URL greyed out”

There may be different reasons for this error to appear. Let’s list two of the most common reasons.

Error in wp-config.php file

You should be watchful while you move WordPress installation to a different folder. If you forget to delete the code from the wp-config.php file after this process, the error occurs.

Due to SSL

When you add SSL to your site, you should also add a website URL to prevent the “WordPress address URL greyed out” error.

WordPress Address is the address to reach your blog. In addition, the address of core files is named as Site Address. Both these addresses should match with each other unless you are giving its own directory. There may be different reasons for you to change these addresses. Either you may be changing the domain or moving to a sub-domain. Furthermore, you may be selecting different versions of the site that include or exclude www versions of the site. 

Change WordPress login URL

Open Settings > General, you will see the option to change the WordPress address and site address.

WordPress address URL greyed out
WordPress Address URL

In case, the WordPress address URL is greyed out, you need to apply other methods listed below. 

Change WordPress URL in wp-config file

So when you install WordPress in a different directory, you will unknowingly move WordPress to a different location. This results in a URL greyed out. To solve this issue, you need to take care of the following things:

If you have access to Cpanel, this problem can be solved easily. First of all, log in to the File Manager.

How to change WordPress URL - File Manager
File Manager

Since WordPress installations are found under the public_html directory, Open that folder.

public_html folder
public_html folder

Check the wp-config.php file inside that folder.

wp-config
wp-config.php

Before you move further, download this file so that it will serve as a backup. After you have a copy of the wpconfig.php file then open that file in edit mode.

You will see the two lines starting with WP_HOME and WP_SITEURL. After you locate these two lines, carefully delete only these two lines from the file. 

Save these changes and update the wp-config file.  

Change WordPress URL in database

If you are familiar with how a database works, then you must know that you can change WordPress URL.

At first, find your database from phpMyAdmin and open it.

phpMyAdmin
phpMyAdmin

You will find the “wp_options” table inside each database. However, sometimes the prefix may be different. Anyway, look for the suffix _options.

change wordpress url in database
Change WordPress URL in database

Furthermore, check the values of “siteurl” and “home” rows. Carefully enter the URL before you save it as the dashboard will be accessible only from the new URL.

Change WordPress URL with WP-CLI 

This method is only recommendable if you are a developer. If your hosting provider provides SSH access, then you can use WP-CLI.

You can update the WordPress URL with the command written below.

wp option update home ‘https://demosite.com’
wp option update siteurl ‘https://demosite.com’ 

After you follow any of the above-listed methods to change WordPress URL, then go to Settings > General in WordPress dashboard.

You will see that the WordPress address URL and Site URL is changed and WordPress address URL greyed out no longer troubles you.

Wrapping Up

After reading this post, hopefully, you have learned how to change WordPress URL. In addition, you may now know the possible reasons why WordPress address URL greyed out appears in your site. In case if you are not able to change WordPress site URL from the admin dashboard, you can do it from various other methods mentioned in this post.

Additional Readings: