WordPress如何移除离线编辑器端口和加载DNS

追格官方小助手/ 2022年07月21日/ WordPress/ 浏览 1050

WordPress如何移除离线编辑器端口和加载DNS,我们只需将以下代码放到当前WordPress主题 functions.php 中即可。


1、WordPress移除离线编辑器端口


remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );


2、WordPress移除加载DNS


function remove_dns_prefetch( $hints, $relation_type ) {
    if ( 'dns-prefetch' === $relation_type ) {
        return array_diff( wp_dependencies_unique_hosts(), $hints );
    }

    return $hints;
}
add_filter( 'wp_resource_hints', 'remove_dns_prefetch', 10, 2 );


发表评论

暂无评论,抢个沙发...

客服 工单