Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Save Plugin Error Messages in the database for The Plugin Generated x Characters of Unexpected Output During Activation errors
<?php
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' );
/* Or you could do the following: */
file_put_contents( 'C:\errors' , ob_get_contents() ); // or any suspected variable
@phillipsharring

This comment has been minimized.

Copy link

@phillipsharring phillipsharring commented Jun 21, 2016

You should add delete_option( 'plugin_error' ); after the error is displayed or written so you don't end up thinking you're continuing to have errors. I added this to mine after scratching my head a while... 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment