4

According to this question, it's possible to turn on/off WP_DEBUG for specific sites on a multisite.

Is it possible to do this with a sub-directory multisite?

4

You can do this by adding some code to wp-config.php

$request_uri = $_SERVER['REQUEST_URI'];
$debug_dirs = array ('/debug-dir1/','/debug-dir2/'); // list of directories to turn on debugging
foreach ($debug_dirs as $debug_dir) {
    if (!strncmp($request_uri,$debug_dir,strlen($debug_dir))) {
        define('WP_DEBUG', true);
    } 
}
define('WP_DEBUG', false); // debug off by default
  • doesn't work for me (WP 3.8.1). maybe it's because the debug_dirs only exist virtually through permalinks and aren't actual folders!? – jan reimers Jan 30 '14 at 22:48
  • Sorry, I had it working and then changed it when I pasted the code in here. The problem is that defining WP_DEBUG should only happen once. The default WP_DEBUG setting (false) has to happen at the very end and not the beginning! – user42826 Jan 30 '14 at 23:53
0

Here is what worked for me

$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (strpos($url,'sitename') !== false) {
            define('WP_DEBUG', true);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.