Created
January 23, 2020 09:25
-
-
Save younes-dro/a9f6ad5afdf39070b2463cafd5f45b82 to your computer and use it in GitHub Desktop.
Catch Errors when activating a Plugin on register_activation_hook()
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
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