Skip to content

Instantly share code, notes, and snippets.

@lordspace
Created April 23, 2014 01:40
Show Gist options
  • Save lordspace/11200213 to your computer and use it in GitHub Desktop.
Save lordspace/11200213 to your computer and use it in GitHub Desktop.
Log plugin activation errors.
<?php
// install it in mu-plugins
add_action('activated_plugin', 'dbg_log_error', 0, 2);
function dbg_log_error($plugin, $network_wide) {
if (ob_get_length() == 0) {
return ;
}
$buff = '';
$buff .= "Plugin: $plugin\n";
$buff .= sprintf("Network Wide: %s\n", $network_wide ? 'No' : 'Yes');
$buff .= "Output:\n";
$buff .= ob_get_contents() . "\n\n";
file_put_contents(WP_CONTENT_DIR. '/plugin_activation_error.log', $buff, FILE_APPEND);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment