edit: and just discovered the 'guid' column on the posts table is hardcoded as the URL of the post -- the domain you're on at the time you create the content + the post ID. Seems like a nightmare for content staging on a non-prod environment.
It comes up every so often. The WordPress devs are well aware of the platform's warts & WTFs. People have talked for a while about replacing it with a proper UUID, but there are way too many themes & plugins that use the guid field to get the post's URL instead of calling, say, get_permalink( $post_id ).
So now the devs are stuck. You can deprecate "guid", but you can't get rid of it. You can't replace the URL with a UUID because of backwards compatibility with third-party code. Do you add a "uuid" column? Now you have a guid column & a uuid column and people are going to get even more confused.
Right now, content staging is a bit of an edge case and folks who need it are able to store a UUID in a post_meta field. So it's not a really critical issue. But it would definitely be nice to see a proper UUID in core.
Some relevant Trac tickets:
Guids No Longer Have Permalink Format (discusses changing the format) https://core.trac.wordpress.org/ticket/6492
Non-URL GUIDs are stripped on post update https://core.trac.wordpress.org/ticket/18395
URLs delivered to the browser should be root-relative https://core.trac.wordpress.org/ticket/17048
WP Development & Production Sites http://lists.automattic.com/pipermail/wp-hackers/2010-Novemb...
Relative vs. Absolute URLs stored in db http://lists.automattic.com/pipermail/wp-hackers/2010-Decemb...
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.
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.
Not as easy as you make it sound.