Doc WordPress WordPress Tricks, Tips & Snippets


Fix access problems after domain / site url change

Whenever you need to change the domain under which your WordPress installation is to be found it is necessary to change both the "WordPress Address (URL)" setting and the "Site Address (URL)" setting, which are found in WordPress's backend under "Settings" > "General".

Right after you click "Save" you are logged out (because your session is bound to the domain) and sometimes it is tricky or even impossible to login again, for example if you entered an incorrect domain or something like that. Gladly there are two easy ways to change these crucial settings through either the functions.php (which can be found in your active theme's folder) or the wp-config.php (which can be found in the website's root)!

Method 1: wp-config.php

Add this to your wp-config.php:


Please note: as long as this entry exists in the wp-config.php the values can't be changed anymore via backend, this is like hardcoding the values.

Method 2: functions.php

Add this to your functions.php:


Please note: it is important to remove this entry once you are back in backend and and the site is running normally again!

Et voilĂ : you should be able to log in again now. If not clear your browser's cache!


Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.