Skip to content

Instantly share code, notes, and snippets.

@mandiwise
Last active January 27, 2017 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandiwise/254e4db53686c07fccf5 to your computer and use it in GitHub Desktop.
Save mandiwise/254e4db53686c07fccf5 to your computer and use it in GitHub Desktop.
Save an option to the database containing unexpected output during plugin activation
<?php
/**
* Usage: "echo get_option('plugin_error');" or look for the option the DB after activation
*
* @link http://thehungrycoder.com/wordpress/how-i-have-solved-the-the-plugin-generated-xxxx-characters-of-unexpected-output-during-activation-problem.html
*/
function save_error(){
update_option( 'plugin_error', ob_get_contents()) ;
}
add_action( 'activated_plugin','save_error' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment