Support » Fixing WordPress » WP_DEBUG on only for admin user?

  • Hi there,

    How would I set WP_DEBUG to true, only for the admin user? I tried checking for the user ID 1, via:

    if(function_exists(“wp_get_current_user”) && wp_get_current_user()->ID == 1)
    define(‘WP_DEBUG’, true);
    define(‘WP_DEBUG’, false);

    I tried putting this in both the config file and the header file of my theme, though neither worked. Has anyone done this?

Viewing 1 replies (of 1 total)
  • I think that wp-config.php is too early to check for the user, and your theme’s functions.php file is too late to define WP_DEBUG – of course I could be wrong…

    Instead you could setup an error log, and silence the notices.

    * This will log all errors notices and warnings to a file called debug.log in
    * wp-content (if Apache does not have write permission, you may need to create
    * the file first and set the appropriate permissions (i.e. use 666) )
    define(‘WP_DEBUG’, true);
    define(‘WP_DEBUG_LOG’, true);
    define(‘WP_DEBUG_DISPLAY’, false);

Viewing 1 replies (of 1 total)
  • The topic ‘WP_DEBUG on only for admin user?’ is closed to new replies.