Created
June 16, 2020 00:16
-
-
Save utkrishta/27ccc5bd4eff453b80849e8affe01526 to your computer and use it in GitHub Desktop.
Remove WordPress Bloat
This file contains hidden or 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 | |
/* | |
* Remove WP Bloat | |
* Please Note: This removes WP bloat for better performance. Remove or add feaures as necessary | |
*/ | |
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 ); | |
remove_action( 'template_redirect', 'wp_shortlink_header', 11 ); | |
remove_action('wp_head', 'rsd_link'); //removes EditURI/RSD (Really Simple Discovery) link. | |
remove_action('wp_head', 'wlwmanifest_link'); //removes wlwmanifest (Windows Live Writer) link. | |
remove_action('wp_head', 'wp_generator'); //removes meta name generator. | |
remove_action('wp_head', 'wp_shortlink_wp_head'); //removes shortlink. | |
remove_action( 'wp_head', 'feed_links', 2 ); //removes feed links. | |
remove_action('wp_head', 'feed_links_extra', 3 ); //removes comments feed. | |
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 ); | |
remove_action( 'wp_head', 'wp_oembed_add_host_js' ); | |
remove_action('rest_api_init', 'wp_oembed_register_route'); | |
remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10); | |
remove_action( 'wp_head', 'wp_resource_hints', 2 ); | |
function remove_api () { | |
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 ); | |
remove_action('template_redirect', 'rest_output_link_header', 11); | |
} | |
add_action( 'after_setup_theme', 'remove_api' ); | |
// Disables Pesky 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_filter( 'the_content_feed', 'wp_staticize_emoji' ); | |
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); | |
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); | |
/// Disables Embeds | |
function deregister_embed_scripts() { | |
wp_dequeue_script( 'wp-embed' ); | |
wp_deregister_script( 'wp-embed' ); | |
} | |
add_action( 'wp_print_scripts', 'deregister_embed_scripts' ); | |
//Remove the gutenberg styles | |
function deregister_gutenberg_styles() { | |
wp_dequeue_style( 'wp-block-library' ); | |
wp_deregister_style( 'wp-block-library' ); | |
} | |
add_action( 'wp_print_styles', 'deregister_gutenberg_styles', 100 ); | |
?> |
that sounds good. but not entire community wants to get rid of so many inbuilt features of WordPress which I have gotten rid just because I don't want them (example: Gutenberg, Emojis, etc).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not commit those the Offical wordpress repo as a pull request, which would help the entire community instead.