Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Enable WordPress debug log to a private folder not accessible from the web. See for details and motivations. NB: currently needs to be manually edited to specify the private folder path;
Plugin Name: Private Debug Log
Description: Enable debug log to a private folder not accessible from the web
Version: 0.0.1
Author: WebAware
Author URI:
copyright (c) 2013 WebAware Pty Ltd (email :
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Edit the location of $debuglog to specify a folder outside your website root, inaccessible to web browsers.
Some common folder names are 'private', '_private', 'tmp'
// for testing, will put debug log in folder wp-content/uploads
//~ $debuglog = WP_CONTENT_DIR . '/uploads';
// put debug log in folder ../private (i.e. outside the web root)
$debuglog = dirname(ABSPATH) . '/private';
ini_set('log_errors', 1);
ini_set('error_log', $debuglog . '/debug.log');
error_log(basename(__FILE__) . ': if you can read this, close enough.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.