WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes I forget to empty my debug.log file (or that it exists) and after trying to get around a bug, I find it having simply too much content to open it in ex. the basic Windows Text Editor.

Part of my wp-config.php file:

error_reporting( E_ALL );
define( 'WP_DEBUG',         true );
define( 'SAVEQUERIES',      true );
define( 'WP_DEBUG_LOG',     true ); // file: /core_root/wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', true );

Question: Is there a way to do this via Wordpress, or do I have to do it with basic php functions?

share|improve this question
Notepad++ or gVim should be able to open the file for you, if you don't need a code solution. – jjeaton Aug 12 '11 at 2:08
@jjeaton Thanks. But I'm really searching for a solution to not have a xyGB file in my dev environment. – kaiser Aug 12 '11 at 2:32
up vote 4 down vote accepted

Create a cron job for a function which checks the file size and runs unlink( WP_CONTENT_DIR . '/debug.log' ) if necessary.

share|improve this answer
Sounds like a plugin. Thanks! (+1). – kaiser Aug 12 '11 at 11:52

Your Answer


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.