News for hackers. Stuff that matters.
Re:WooThemes joins Automattic by deckiedan on Tuesday May 19, 2015 @08:19PM (#9573959)
Because of this:

1) Users want to be able to update site-name (etc) from the admin interface.

2) We therefore need to store it somewhere.

3) We have a database!

The alternatives are:

- Storing in wp-config.php (which is also done...), but then it's not user-editable from the admin interface.

- Storing in a INI or JSON or similar document, which has only marginal if any benefits over storing in the database.

For deployment, since the location of the database values is fixed, you can set the variables with your deployment scripts.

Re:WooThemes joins Automattic by Domenic_S on Tuesday May 19, 2015 @09:14PM (#9574137)
Certainly there are configuration options that are appropriate to store in the database, but I'm trying to understand why domain is one of them. The site knows what domain it is on by virtue of being hosted on that domain.

Storing the domain in the DB may be reasonable if it's done once, but WP does it multiple times: WP_SITEURL ("the address where your WordPress core files reside"), WP_HOME ("the address you want people to type in their browser to reach your WordPress blog") and of course GUIDs for every post have the domain hardcoded into their values (that can mess up links in a weird way, where you're on your local environment, click a link, and now you're silently on prod).

I could definitely be missing something, but I can't for the life of me figure out why this is a good idea.

Re:WooThemes joins Automattic by MichaelTieso on Tuesday May 19, 2015 @09:43PM (#9574227)
There are only two places where the URL should be stored. Anywhere else is an issue with the plugin or theme storing them incorrectly. Both are contained within the wp_options table for home URL and site URL. Those are the only values required to be changed. If you have a development environment, you should not be migrating the wp-config.php file anyway as it has sensitive information for product sites thus on your dev site you can have a separate wp-config.php file to take into account the new values for home and site URL's.
Re:WooThemes joins Automattic by spydum on Tuesday May 19, 2015 @09:27PM (#9574177)
You aren't missing anything. This problem has been there in WP for a long time, and it makes staging/testing/migration setups a horrible pain (as others have suggested, lots of search & replace).
Re:WooThemes joins Automattic by jdub on Wednesday May 20, 2015 @07:11AM (#9575552)
It's two constants in your dev environment wp-config.php, nothing more.
Re:WooThemes joins Automattic by purephase on Tuesday May 19, 2015 @09:16PM (#9574145)
But, it's stored all over the place, not just a single table or file. All of the URLs on the site get put into the DB as fully qualified. Just today, I had to do a search-and-replace with wp-cli on 26k instances of the domain name in the db.

Not as easy as you make it sound.

Re:WooThemes joins Automattic by oldmanjay on Tuesday May 19, 2015 @09:09PM (#9574124)
Giving users everything they want is a surefire way to build a disaster of a codebase. I have no knowledge of WordPress, that's just a general principle. Users are a bit too silly to trust.