-
-
Save XTechnology-TR/915fcf508bfb2e64ad3d24ed1418ce9b to your computer and use it in GitHub Desktop.
Optimization
This file contains 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 | |
/***** WORDPRESS OPTIMIZATION CODE *****/ | |
// REMOVE EMOJIS | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); | |
// REMOVE VERSION QUERY STRINGS FROM STATIC RESOURCES (WITH ARRAY OF EXCEPTIONS) | |
add_filter( 'script_loader_src', 'ewp_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', 'ewp_remove_script_version', 15, 1 ); | |
function ewp_remove_script_version( $src ) { | |
$exceptions = array( 'layout.css', 'layout.js' ); | |
foreach ( $exceptions as $item ) { | |
if ( stripos( $src, $item ) !== FALSE ) { | |
return $src; | |
} | |
} | |
return remove_query_arg( 'ver', $src ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment