[wp-hackers] Why WP_SITEURL and not $_SERVER['HTTP_HOST']?

Beau Lebens beau at dentedreality.com.au
Tue Mar 30 06:47:34 UTC 2010


> I've been wondering this for a long time but never asked this.  Anyone know why WordPress doesn't just use $_SERVER['HTTP_HOST'] and instead requires setting of WP_SITEURL (and WP_HOME?)

All of the $_SERVER variables are writeable, so
plugins/themes/anything could modify what they contain, "corrupting"
your theoretically "pristine" way of referring the the URL of the
current site.

Setting it as a constant is really about the only way of knowing that
it's set once, never modified, and contains exactly what it's supposed
to contain.

Beau


More information about the wp-hackers mailing list