admin管理员组

文章数量:1426091

I recently set up my WordPress website and just noticed that if I click the home page from any other page, it points to the IP of my instance and the website won’t load. I have checked the URL(s) from the admin panel SettingsGeneral. They are correctly configured but currently grayed out. Is the only solution to this is to edit the wp-config.php file?

I recently set up my WordPress website and just noticed that if I click the home page from any other page, it points to the IP of my instance and the website won’t load. I have checked the URL(s) from the admin panel SettingsGeneral. They are correctly configured but currently grayed out. Is the only solution to this is to edit the wp-config.php file?

Share Improve this question edited May 24, 2019 at 22:07 Fayaz 9,0172 gold badges33 silver badges51 bronze badges asked May 24, 2019 at 21:26 user3755632user3755632 1134 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

The URLs are greyed out in the Settings page because of the entries in the wp-config.php file. If there are entries for these values, those values override the values in the wp-options table, and the override makes the Settings values uneditable.

See this in the Codex: https://wordpress/support/article/changing-the-site-url/

It is possible to set the site URL manually in the wp-config.php file.

Add these two lines to your wp-config.php, where example is the correct location of your site.

define( 'WP_HOME', 'http://example' );
define( 'WP_SITEURL', 'http://example' );

This is not necessarily the best fix, it’s just hard-coding the values into the site itself. You won’t be able to edit them on the General settings page anymore when using this method.

(Emphasis added)

That's why I am not a big fan of making URL changes in the wp-config.php file. I think it is better (and more proper) to change those values in the wp-options table. (IMHO).

Look at your wp-config.php for those two 'defines'. I'd bet that you would find values there. I think that it is better to put those URLs in the wp-options table. Again, IMHO.

本文标签: