/*** 精简系统加载 ***/   
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
//移除feed_links和feed_links_extra函数
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'index_rel_link' );
//wp_head钩子中移除了其他几个不常用的函数
remove_action( 'wp_head', 'wc_generator_tag' );
remove_action( 'wp_head', 'wc_products_rss_feed' );
//针对WooCommerce插件,移除了其生成的一些头部信息
remove_action( 'wp_head', 'rel_canonical' );
remove_action( 'wp_head', 'rest_output_link_wp_head' );
remove_action( 'wp_head', 'wp_generator' );
//移除头部的一些其他元信息。
//remove_action( 'wp_head', 'wp_print_styles', 8 );
//remove_action( 'wp_head', 'wp_print_head_scripts', 9 );
//移除WordPress头部输出的样式和脚本链接
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
//移除了oEmbed发现链接
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
//移除了WordPress头部的一些关联链接
remove_action( 'wp_head', 'locale_stylesheet' );
//移除了本地化的样式表链接
remove_action( 'wp_head', 'noindex', 1 );
//移除了noindex元标签,通常用于阻止搜索引擎索引页面
remove_action( 'wp_footer', 'wp_print_footer_scripts' );
//从页脚移除了脚本链接的输出
remove_action( 'publish_future_post','check_and_publish_future_post',10, 1 );
//移除了一个在发布未来日期文章时的钩子
remove_action( 'template_redirect', 'rest_output_link_header', 11 );
remove_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
//从template_redirect钩子中移除了一些函数
add_filter( 'multilingualpress.hreflang_type', '__return_false');
add_filter( 'wp_sitemaps_enabled', '__return_false' );
//移除自带的地图文件,一般使用seo插件地图
add_filter( 'xmlrpc_enabled', '__return_false' );
add_filter( 'xmlrpc_methods', '__return_empty_array' );
//禁用WordPress的XML-RPC功能,一些安全问题。
add_action( 'widgets_init', 'my_remove_recent_comments_style' );
function my_remove_recent_comments_style() {
   global $wp_widget_factory;
   remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'] ,'recent_comments_style'));
   } 
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
   wp_deregister_script('heartbeat');
   }
//移除最近评论的小部件样式,并停用heartbeat脚本

归类于: