SHARE
TWEET

Untitled

a guest Jun 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Add Security Key and appropiate tags Enqueued Scripts & Styles.
  3.  *
  4.  * @param string $tag      Script Tags to display.
  5.  * @param string $handle   Name of file specified above.
  6.  */
  7. function script_security_checks( $tag, $handle ) {
  8.  
  9.     $scripts = array( 'script_handle' );
  10.  
  11.     foreach ( $scripts as $script ) {
  12.         if ( $script === $handle ) {
  13.             return str_replace( ' src', ' async defer integrity="####-###################-##############" crossorigin="anonymous" src', $tag );
  14.         }
  15.     }
  16.     return $tag;
  17. }
  18. add_filter( 'script_loader_tag', 'script_security_checks', 10, 2 );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top