Last active
April 17, 2017 18:21
-
-
Save lukecav/e68b9ffc645449bdaf052c1eb0dc813c to your computer and use it in GitHub Desktop.
WordPress Page Speed Improvements.
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
// Remove Emojis | |
// Emojis are enabled by default, so if you don't want to use these you can remove the script and stylesheet: | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
// Remove comment-reply.min.js | |
// This is added by default to the footer, if you're not using post comments or DISQUS you can remove the script: | |
function remove_comment_reply_script(){ | |
wp_deregister_script( 'comment-reply' ); | |
} | |
add_action('init','remove_comment_reply_script'); | |
// Remove WP embed script | |
// Removal of URL embedding for tweets, YouTube videos etc on the front-end | |
function speed_stop_loading_wp_embed() { | |
if (!is_admin()) { | |
wp_deregister_script('wp-embed'); | |
} | |
} | |
add_action('init', 'speed_stop_loading_wp_embed'); | |
//* Remove query strings from static resources | |
function _remove_script_version( $src ){ | |
$parts = explode( '?ver', $src ); | |
return $parts[0]; | |
} | |
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment