Remove all trash scripts in frontend wordpress 4.6. Just add this code in functions.php file, in your theme directory.
<?php
//Remove trash scripts in frontend
function disable_embeds_init() {
// Turn off oEmbed auto discovery.
// Don't filter oEmbed results.
remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10);
//remove emoji
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
//remove emoji END*/
//remove meta generator
add_filter('the_generator', '__return_empty_string');
//remove rsd
remove_action( 'wp_head', 'rsd_link' );
//remove RSS list
function delRSS() {
wp_die('<p>RSS-ленты на сайте не доступны!</p>');
}
add_action('do_feed', 'delRSS', 1);
add_action('do_feed_rdf', 'delRSS', 1);
add_action('do_feed_rss', 'delRSS', 1);
add_action('do_feed_rss2', 'delRSS', 1);
add_action('do_feed_atom', 'delRSS', 1);
//remove RSS listend
// wp-json
add_filter('rest_enabled', '_return_false');
add_filter('rest_jsonp_enabled', '_return_false');
// xmlrpc.php
add_filter('xmlrpc_enabled', '__return_false');
// disable REST API
add_filter('rest_enabled', '__return_false');
remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
remove_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
remove_action( 'template_redirect', 'rest_output_link_header', 11, 0 );
remove_action( 'auth_cookie_malformed', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_expired', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_bad_username', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_bad_hash', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_valid', 'rest_cookie_collect_status' );
remove_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 );
// disbale event REST API
remove_action( 'init', 'rest_api_init' );
remove_action( 'rest_api_init', 'rest_api_default_filters', 10, 1 );
remove_action( 'parse_request', 'rest_api_loaded' );
// disable Embeds REST API
remove_action( 'rest_api_init', 'wp_oembed_register_route' );
remove_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
//if you need use json, just comment below line
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
//remove <link rel="dns-prefetch" href="//s.w.org">
remove_action( 'wp_head', 'wp_resource_hints', 2 );
// remove <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://yoursite/wlwmanifest.xml">
remove_action('wp_head', 'wlwmanifest_link');
}
add_action('init', 'disable_embeds_init', 9999);
// END Remove trash scripts in frontend END
?>