Skip to content

Instantly share code, notes, and snippets.

@bob-moore
Created July 20, 2021 01:24
Show Gist options
  • Save bob-moore/039a4a9aaf3730a6df72f9e4bf34cc99 to your computer and use it in GitHub Desktop.
Save bob-moore/039a4a9aaf3730a6df72f9e4bf34cc99 to your computer and use it in GitHub Desktop.
<?php
function prefix_print_error( $item, $action = 'shutdown' ) {
add_action( $action, function() use( $item ) {
printf( '<script>console.log(%s);</script>', json_encode( $item, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_PRETTY_PRINT ) );
}, 9999 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment