I use global variable $table_prefix
to differ whether I work on Word Press or WPMU. I need this global variable for my plugin. But is there any better way to check whether your pluggin is working on Word Press or WPMU?
Asked
Active
Viewed 236 times
3 Answers
1
In WPMU a global variable named wpmu_version
should be set.

Richard M
- 14,244
- 6
- 52
- 48
-
yes, that's it. i should use isset rather then compare its table_prefix. i'm too focus with it's return value. As you know, in wp, they got $wp_version as global variable. Thank you – justjoe Mar 15 '10 at 15:17
1
for my checks I use a function I found
// from http://frumph.net/wordpress/wordpress-plugin-theme-check-for-multisitewpmu/
// check for multisite. Returns boolean
function check_this_is_multsite() {
global $wpmu_version;
if (function_exists('is_multisite')){
if (is_multisite()) {
return true;
}
if (!empty($wpmu_version)){
return true;
}
}
return false;
}
use it like this
if(check_this_is_multsite()){
// is on wpmu
} else {
// is on single
}

CommentLuv
- 1,079
- 1
- 9
- 14
0
You could define a constant:
e.g.
define('ENVIRONMENT', 'WP');
define('ENVIRONMENT', 'WPMU');

fire
- 21,383
- 17
- 79
- 114
-
wow this is a good suggestion. But what if i'm a pluggin developer. i need to know it without able to access/read wp-config.php (i think my question misleed you) – justjoe Mar 15 '10 at 14:14