Skip to content

Instantly share code, notes, and snippets.

@younes-dro
Created January 23, 2020 09:25
Show Gist options
  • Save younes-dro/a9f6ad5afdf39070b2463cafd5f45b82 to your computer and use it in GitHub Desktop.
Save younes-dro/a9f6ad5afdf39070b2463cafd5f45b82 to your computer and use it in GitHub Desktop.
Catch Errors when activating a Plugin on register_activation_hook()
function tl_save_error() {
update_option( 'plugin_error', ob_get_contents() );
}
add_action( 'activated_plugin', 'tl_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