Board Deng: WordPress Remove the head superfluous js/css/feed

Source: Internet
Author: User
Tags wordpress version

WordPress Remove the head of the redundant JS

Copy code to function.php file

/** * Disable The emoji ' s remove the header automatically loaded JS*/ functionDisable_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 ' ); Add_filter (' Tiny_mce_plugins ', ' disable_emojis_tinymce ' ); } add_action (' Init ', ' Disable_emojis ' );/** * Filter function used to remove the tinymce emoji plugin.*/ functionDISABLE_EMOJIS_TINYMCE ($plugins ) { if(Is_array($plugins ) ) { return Array_diff($plugins,Array(' Wpemoji ' ) ); } Else { return Array(); } }

WordPress Remove the extra version of the header information:

Copy code to function.php file

 //Remove excess head code to complete site accelerationRemove_action (' Wp_head ', ' wp_enqueue_scripts ', 1);//calls to JavaScriptRemove_action (' Wp_head ', ' feed_links ', 2);//Remove FeedRemove_action (' Wp_head ', ' Feed_links_extra ', 3);//Remove FeedRemove_action (' Wp_head ', ' rsd_link ');//Remove Offline Editor Open InterfaceRemove_action (' Wp_head ', ' wlwmanifest_link ');//Remove Offline Editor Open InterfaceRemove_action (' Wp_head ', ' index_rel_link ');//Remove unique link information on this pageRemove_action (' Wp_head ', ' Parent_post_rel_link ', 10, 0);//Clear Contextual InformationRemove_action (' Wp_head ', ' Start_post_rel_link ', 10, 0);//Clear Contextual InformationRemove_action (' Wp_head ', ' adjacent_posts_rel_link_wp_head ', 10, 0); Remove_action (' Wp_head ', ' Locale_stylesheet '); Remove_action (' Publish_future_post ', ' check_and_publish_future_post ', 10, 1); Remove_action (' Wp_head ', ' noindex ', 1); Remove_action (' Wp_head ', ' wp_print_styles ', 8);//Loading CSSRemove_action (' Wp_head ', ' wp_print_head_scripts ', 9); Remove_action (' Wp_head ', ' wp_generator ');//removing the WordPress versionRemove_action (' Wp_head ', ' rel_canonical '); Remove_action (' Wp_footer ', ' wp_print_footer_scripts '); Remove_action (' Wp_head ', ' wp_shortlink_wp_head ', 10, 0); Remove_action (' Template_redirect ', ' Wp_shortlink_header ', 11, 0); Add_action (' Widgets_init ', ' My_remove_recent_comments_style ');functionMy_remove_recent_comments_style () {Global $WP _widget_factory; Remove_action (' Wp_head ',Array($WP _widget_factory->widgets[' wp_widget_recent_comments '], ' Recent_comments_style '));} 

Board Deng: WordPress Remove the head superfluous js/css/feed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.