Skip to content

Instantly share code, notes, and snippets.

@studiograsshopper
Created April 15, 2013 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save studiograsshopper/5385786 to your computer and use it in GitHub Desktop.
Save studiograsshopper/5385786 to your computer and use it in GitHub Desktop.
Plugin debugging - tracking down "The plugin generated xxx characters of unexpected output during activation." errors. I didn't invent it, but found it on a few places on the web, including wp.org support forums.
<?php
add_action('activated_plugin','save_error');
/**
* Place entire block of code at foot of wp-admin/includes/plugin.php
* Don't forget to remove code after use!
*
* Location of error_activation.html must be writeable, eg in your uploads folder somewhere
*/
function save_error(){
file_put_contents( ABSPATH . 'wp-content/{somewhere writeable}/error_activation.html', ob_get_contents() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment