Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Add Security Key and appropiate tags Enqueued Scripts & Styles.
- *
- * @param string $tag Script Tags to display.
- * @param string $handle Name of file specified above.
- */
- function script_security_checks( $tag, $handle ) {
- $scripts = array( 'script_handle' );
- foreach ( $scripts as $script ) {
- if ( $script === $handle ) {
- return str_replace( ' src', ' async defer integrity="####-###################-##############" crossorigin="anonymous" src', $tag );
- }
- }
- return $tag;
- }
- add_filter( 'script_loader_tag', 'script_security_checks', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement