Forked from lgladdy/acf-unsafe-html-detection-backtrace.php
          
        
    
          Created
          January 30, 2024 17:23 
        
      - 
      
 - 
        
Save andreicnegrea/ebc5d3fe6d0f75b62f18bfda97761348 to your computer and use it in GitHub Desktop.  
    Print backtrace on the frontend when potentially unsafe HTML is removed
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?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