[wp-hackers] WPMU VHOST constant

Will Anderson wp-hackers at itsananderson.com
Tue Aug 4 20:39:54 UTC 2009

On Tue, Aug 4, 2009 at 4:18 PM, Otto <otto at ottodestruct.com> wrote:

> No, the constant function returns the value, so checking for
> (constant("VHOST") == 'yes') is perfectly acceptable.
> http://www.php.net/manual/en/function.constant.php
> "constant — Returns the value of a constant"
> -Otto
> Sent from Memphis, TN, United States

Ahh, you're right. Had a momentary brain fart and was thinking of "define".
I'd still probably just reference the constant directly because it's most
likely a little more efficient, but the difference, if existent, is slim, so
I think either way's fine.

On the other hand, I really would argue that it's worth the extra bit of
code to check that VHOST is defined. A plugin that needs to worry about
sub-domains versus sub-directories probably won't run well on a
WordPress.org install, but all the same, it could help avoid a warning if
VHOST isn't defined (as would be the case in a WP.org site). It's also a
core PHP lookup, so it will create a negligible performance hit to run the

Will Anderson

More information about the wp-hackers mailing list