Add WP_DEBUG check for #1365