Skip to content

Instantly share code, notes, and snippets.

@boredzo
Created August 20, 2016 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boredzo/a0081a2acb60f7734ca4bb846fb98e8d to your computer and use it in GitHub Desktop.
Save boredzo/a0081a2acb60f7734ca4bb846fb98e8d to your computer and use it in GitHub Desktop.
Banish needless JavaScript from WordPress 4.5.3.
Index: wp-includes/default-filters.php
===================================================================
--- wp-includes/default-filters.php (revision 38151)
+++ wp-includes/default-filters.php (working copy)
@@ -165,7 +165,7 @@
add_filter( 'the_title_rss', 'ent2ncr', 8 );
add_filter( 'the_title_rss', 'esc_html' );
add_filter( 'the_content_rss', 'ent2ncr', 8 );
-add_filter( 'the_content_feed', 'wp_staticize_emoji' );
+#add_filter( 'the_content_feed', 'wp_staticize_emoji' );
add_filter( 'the_content_feed', '_oembed_filter_feed_content' );
add_filter( 'the_excerpt_rss', 'convert_chars' );
add_filter( 'the_excerpt_rss', 'ent2ncr', 8 );
@@ -172,13 +172,13 @@
add_filter( 'comment_author_rss', 'ent2ncr', 8 );
add_filter( 'comment_text_rss', 'ent2ncr', 8 );
add_filter( 'comment_text_rss', 'esc_html' );
-add_filter( 'comment_text_rss', 'wp_staticize_emoji' );
+#add_filter( 'comment_text_rss', 'wp_staticize_emoji' );
add_filter( 'bloginfo_rss', 'ent2ncr', 8 );
add_filter( 'the_author', 'ent2ncr', 8 );
add_filter( 'the_guid', 'esc_url' );
// Email filters
-add_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
+#add_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
// Misc filters
add_filter( 'option_ping_sites', 'privacy_ping_filter' );
@@ -209,19 +209,19 @@
add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
// REST API filters.
-add_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
-add_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
-add_action( 'template_redirect', 'rest_output_link_header', 11, 0 );
-add_action( 'auth_cookie_malformed', 'rest_cookie_collect_status' );
-add_action( 'auth_cookie_expired', 'rest_cookie_collect_status' );
-add_action( 'auth_cookie_bad_username', 'rest_cookie_collect_status' );
-add_action( 'auth_cookie_bad_hash', 'rest_cookie_collect_status' );
-add_action( 'auth_cookie_valid', 'rest_cookie_collect_status' );
-add_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 );
+#add_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
+#add_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
+#add_action( 'template_redirect', 'rest_output_link_header', 11, 0 );
+#add_action( 'auth_cookie_malformed', 'rest_cookie_collect_status' );
+#add_action( 'auth_cookie_expired', 'rest_cookie_collect_status' );
+#add_action( 'auth_cookie_bad_username', 'rest_cookie_collect_status' );
+#add_action( 'auth_cookie_bad_hash', 'rest_cookie_collect_status' );
+#add_action( 'auth_cookie_valid', 'rest_cookie_collect_status' );
+#add_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 );
// Actions
add_action( 'wp_head', '_wp_render_title_tag', 1 );
-add_action( 'wp_head', 'wp_enqueue_scripts', 1 );
+#add_action( 'wp_head', 'wp_enqueue_scripts', 1 );
add_action( 'wp_head', 'feed_links', 2 );
add_action( 'wp_head', 'feed_links_extra', 3 );
add_action( 'wp_head', 'rsd_link' );
@@ -230,28 +230,28 @@
add_action( 'wp_head', 'locale_stylesheet' );
add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
add_action( 'wp_head', 'noindex', 1 );
-add_action( 'wp_head', 'print_emoji_detection_script', 7 );
+#add_action( 'wp_head', 'print_emoji_detection_script', 7 );
add_action( 'wp_head', 'wp_print_styles', 8 );
-add_action( 'wp_head', 'wp_print_head_scripts', 9 );
+#add_action( 'wp_head', 'wp_print_head_scripts', 9 );
add_action( 'wp_head', 'wp_generator' );
add_action( 'wp_head', 'rel_canonical' );
add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
add_action( 'wp_head', 'wp_site_icon', 99 );
-add_action( 'wp_footer', 'wp_print_footer_scripts', 20 );
+#add_action( 'wp_footer', 'wp_print_footer_scripts', 20 );
add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
-add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
+#add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
add_action( 'init', 'check_theme_switched', 99 );
add_action( 'after_switch_theme', '_wp_sidebars_changed' );
-add_action( 'wp_print_styles', 'print_emoji_styles' );
+#add_action( 'wp_print_styles', 'print_emoji_styles' );
if ( isset( $_GET['replytocom'] ) )
add_action( 'wp_head', 'wp_no_robots' );
// Login actions
-add_action( 'login_head', 'wp_print_head_scripts', 9 );
+#add_action( 'login_head', 'wp_print_head_scripts', 9 );
add_action( 'login_head', 'print_admin_styles', 9 );
add_action( 'login_head', 'wp_site_icon', 99 );
-add_action( 'login_footer', 'wp_print_footer_scripts', 20 );
+#add_action( 'login_footer', 'wp_print_footer_scripts', 20 );
add_action( 'login_init', 'send_frame_options_header', 10, 0 );
// Feed Generator Tags
@@ -277,10 +277,10 @@
add_action( 'do_robots', 'do_robots' );
add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 2 );
add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' );
-add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
-add_action( 'admin_print_scripts', 'print_head_scripts', 20 );
-add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' );
-add_action( 'admin_print_styles', 'print_emoji_styles' );
+#add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
+#add_action( 'admin_print_scripts', 'print_head_scripts', 20 );
+#add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' );
+#add_action( 'admin_print_styles', 'print_emoji_styles' );
add_action( 'admin_print_styles', 'print_admin_styles', 20 );
add_action( 'init', 'smilies_init', 5 );
add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
@@ -403,9 +403,9 @@
add_action( 'set_current_user', 'kses_init' );
// Script Loader
-add_action( 'wp_default_scripts', 'wp_default_scripts' );
-add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
-add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
+#add_action( 'wp_default_scripts', 'wp_default_scripts' );
+#add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
+#add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
add_action( 'wp_default_styles', 'wp_default_styles' );
add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
@@ -421,7 +421,7 @@
add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop()
// Media
-add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
+#add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' );
// Nav menu
@@ -451,10 +451,10 @@
add_action( 'wp_head', 'wp_oembed_add_discovery_links' );
add_action( 'wp_head', 'wp_oembed_add_host_js' );
-add_action( 'embed_head', 'enqueue_embed_scripts', 1 );
-add_action( 'embed_head', 'print_emoji_detection_script' );
+#add_action( 'embed_head', 'enqueue_embed_scripts', 1 );
+#add_action( 'embed_head', 'print_emoji_detection_script' );
add_action( 'embed_head', 'print_embed_styles' );
-add_action( 'embed_head', 'wp_print_head_scripts', 20 );
+#add_action( 'embed_head', 'wp_print_head_scripts', 20 );
add_action( 'embed_head', 'wp_print_styles', 20 );
add_action( 'embed_head', 'wp_no_robots' );
add_action( 'embed_head', 'rel_canonical' );
@@ -464,8 +464,8 @@
add_action( 'embed_content_meta', 'print_embed_sharing_button' );
add_action( 'embed_footer', 'print_embed_sharing_dialog' );
-add_action( 'embed_footer', 'print_embed_scripts' );
-add_action( 'embed_footer', 'wp_print_footer_scripts', 20 );
+#add_action( 'embed_footer', 'print_embed_scripts' );
+#add_action( 'embed_footer', 'wp_print_footer_scripts', 20 );
add_filter( 'excerpt_more', 'wp_embed_excerpt_more', 20 );
add_filter( 'the_excerpt_embed', 'wptexturize' );
Index: wp-includes/theme.php
===================================================================
--- wp-includes/theme.php (revision 38151)
+++ wp-includes/theme.php (working copy)
@@ -2131,6 +2131,7 @@
$home_origin = parse_url( home_url() );
$cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) );
+/*
?>
<script type="text/javascript">
(function() {
@@ -2147,6 +2148,7 @@
}());
</script>
<?php
+*/
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment