Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andreicnegrea/ebc5d3fe6d0f75b62f18bfda97761348 to your computer and use it in GitHub Desktop.
Save andreicnegrea/ebc5d3fe6d0f75b62f18bfda97761348 to your computer and use it in GitHub Desktop.
Print backtrace on the frontend when potentially unsafe HTML is removed
<?php
add_action( 'acf/will_remove_unsafe_html', 'print_backtrace_for_unsafe_html_removal', 10, 4 );
add_action( 'acf/removed_unsafe_html', 'print_backtrace_for_unsafe_html_removal', 10, 4 );
function print_backtrace_for_unsafe_html_removal( $function, $selector, $field_object, $post_id ) {
echo '<h4 style="color:red">Detected Potentially Unsafe HTML Modification</h4>';
echo '<pre>';
debug_print_backtrace();
echo '</pre>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment