Skip to content

Instantly share code, notes, and snippets.

@lgladdy
Last active January 30, 2024 17:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lgladdy/e4cb5816c835b11dd2d8f482b16fdcb6 to your computer and use it in GitHub Desktop.
Save lgladdy/e4cb5816c835b11dd2d8f482b16fdcb6 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