Created
July 27, 2016 18:12
-
-
Save sblomberg/8339a09e9da14d837d691057554eec5c to your computer and use it in GitHub Desktop.
Log plugin activation errors to a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this to the bottom of wp-config.php to log plugin activation errors: | |
add_action( 'activated_plugin','fpt_save_error' ); | |
function fpt_save_error( $tmp_plugin ) { | |
$out_txt = PHP_EOL . date( "Y/m/d H:i" ) . ' Plugin activation: ' . $tmp_plugin . ' ---messages--->' . PHP_EOL; | |
$out_txt .= ob_get_contents(); | |
$out_txt .= PHP_EOL . '<---- end plugin activation ---' . PHP_EOL; | |
file_put_contents( ABSPATH. 'wp-content/uploads/plugin_activation.log', $out_txt, FILE_APPEND ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment