Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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
share|improve this answer
    
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 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 at 23:53
    
thanks! works now. –  jan reimers Jan 31 at 2:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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