当前主题的functions.php尾部添加如下代码:

移除dns-prefetch s.w.org

remove_action( 'wp_head', 'wp_resource_hints', 2 );

移除embed

remove_action( 'admin_print_scripts',	'print_emoji_detection_script');
remove_action( 'admin_print_styles', 'print_emoji_styles');
remove_action( 'wp_head', 'print_emoji_detection_script', 7);
remove_action( 'wp_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');

移除api.w.org wp-json

add_filter('rest_enabled', '__return_false');
add_filter('rest_jsonp_enabled', '__return_false');
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );

方法摘自:www.staryue.com/archives/15472.html

Related Posts: WordPress 禁止头部加载dns-prefetch s.w.org embed api.w.org wp-json方法 :

留言

avatar