Created
September 6, 2016 14:55
-
-
Save ethangardner/0580b3d801986effb042cb182d0d8ec8 to your computer and use it in GitHub Desktop.
Captures activation errors for WP plugins
This file contains hidden or 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 | |
// https://www.toddlahman.com/the-plugin-generated-x-characters-of-unexpected-output-during-activation/ | |
function plugin_activate_save_error() { | |
ob_clean(); | |
update_option( 'plugin_error', ob_get_contents() ); | |
} | |
add_action( 'activated_plugin', 'plugin_activate_save_error' ); | |
/* Then to display the error message: */ | |
echo get_option( 'plugin_error' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment