function disable_emojis()
{
remove_action('wp_head', 'wp_generator'); //移除WordPress版本
remove_action('wp_head', 'rsd_link'); //移除离线编辑器开放接口
remove_action('wp_head', 'wlwmanifest_link'); //移除离线编辑器开放接口
remove_action('wp_head', 'index_rel_link'); //去除本页唯一链接信息
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_wp_head', 10, 0); //清除前后文信息
remove_action('wp_head', 'feed_links', 2); //移除feed
remove_action('wp_head', 'feed_links_extra', 3); //移除feed
remove_action('wp_head', 'rest_output_link_wp_head', 10); //移除wp-json链
remove_action('wp_head', 'print_emoji_detection_script', 7); //头部的JS代码
remove_action('wp_head', 'wp_print_styles', 8); //emoji载入css
remove_action('wp_head', 'rel_canonical'); //rel=canonical
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); //rel=shortlink
add_filter('wp_resource_hints', 'remove_dns_prefetch', 10, 2); //头部加载DNS预获取(dns-prefetch)
}
add_action('init', 'disable_emojis');//移除wpemojiSettings
//移除WordPress头部加载DNS预获取(dns-prefetch)
function remove_dns_prefetch($hints, $relation_type)
{
if ('dns-prefetch' === $relation_type) {
return array_diff(wp_dependencies_unique_hosts(), $hints);
}
return $hints;
}wordpress去掉头部多余标签
- 版权所属:笑清风的个人随笔
- 文章作者:笑清风
- 本文地址:http://biggerhe.cn/278.html
- 版权声明:原创文章,转载时必须以链接形式注明原始出处及本声明。
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。


微信扫一扫,打赏作者吧~