is_multisite()
Checks whether multisite support is enabled on the site. Conditional tag.
Works at an early stage of WordPress loading, even before the SHORTINIT constant.
Used By: is_main_site()
1 time — 0.000009 sec (speed of light) | 50000 times — 0.01 sec (speed of light) | PHP 7.0.8, WP 4.6.1
No Hooks.
Returns
true|false.
Usage
if ( is_multisite() ) {
echo 'Мультисайтовость включена';
}
Examples
#1 Do anything if multisite mode is enabled
if ( is_multisite() ) {
// do staff for multisite
}
Changelog
| Since 3.0.0 | Introduced. |
is_multisite() is multisite code WP 7.0
function is_multisite() {
if ( defined( 'MULTISITE' ) ) {
return MULTISITE;
}
if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) {
return true;
}
return false;
}