Hard coding your site URL in WordPress

I discovered this handy feature on troubleshooting a login problem for a client of mine.

If you swap your WP database between a development and production server at all regularly and don’t fancy editing your site URL and WordPress URL in the wp-options table each time (either directly or via the WP admin interface)… you can hard code it into the wp-config.php file! Tie this together with WordPress ability to keep this config file out of harms way in a directory above your WP install (ie out of your public_html directory) and you have an easy hands free file sync operation too.

Just add these two lines of code into wp-config.php:

// hardcoding the domain

BTW – note the lack of trailing slashes on the URLs

  1. #1 by akoloskov on August 20, 2012 - 7:06 am

    I need some help with my WP-based website (www.photigy.com), would you be able to help?
    Please contact me if you are interested. Thank you!

You must be logged in to post a comment.