If you are reading this, you are likely in a position where you are unable to edit the WordPress Address and Site Address fields in your WordPress admin;
If you haven’t dealt with this scenario before, it can be frustrating, but the root of this little problem lies in the
wp-config.php file. It’s actually possible to set these values using PHP constants, as per the following example;
// Somewhere in wp-config.php… // … define( 'WP_HOME', 'http://mysite.com/wp' ); define( 'WP_SITEURL', 'http://mysite.com' ); /* That's all, stop editing! Happy blogging. */ // …
When these constants are set, the WordPress admin settings are disabled.
Setting the constants has a few benefits;
/wpdirectory alongside the
/wp-contentdirectory, but the live site follows a different structure. By keeping these settings out of the database, I mitigate the possibility of killing my live site when I push the database to production.
Simple, just find the definition of these two constants in your
wp-config.php file and comment them out. The result should look something like the following;
// Somewhere in wp-config.php… // … // define( 'WP_HOME', 'http://mysite.com/wp' ); // define( 'WP_SITEURL', 'http://mysite.com' ); /* That's all, stop editing! Happy blogging. */ // …
Just be prepared for the possibility of your site going offline if the current values in your database aren’t correct. If this happens, you need to change the values in your
wp_options table…or just work directly with the constants.
If you liked this article, I'd be incredibly grateful if you tweeted about it.
Also, I don't send emails often but when I do, I try to fill them full of useful goodies. If you like code snippets & dev tips, join my mailing list. There's no catch but I'll probably want to tell you about any new plugins & tools I build.