🧹 NHÓM 1: Tắt các script & style không cần thiết

✅ Tắt Gutenberg block CSS (không dùng block editor):

add_action( 'wp_enqueue_scripts', function() {
    wp_dequeue_style( 'wp-block-library' );
    wp_dequeue_style( 'wp-block-library-theme' );
    wp_dequeue_style( 'wc-block-style' ); // WooCommerce block styles
}, 100 );

✅ Tắt emoji JS/CSS (rất thừa với mọi site):

remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );

✅ Tắt oEmbed scripts:

remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
remove_action( 'wp_head', 'wp_oembed_add_host_js' );

✅ Tắt dashicons (nếu không dùng WordPress admin toolbar frontend):

add_action( 'wp_enqueue_scripts', function() {
    if ( ! is_user_logged_in() ) {
        wp_deregister_style( 'dashicons' );
    }
} );

🔧 NHÓM 2: Tối ưu WooCommerce

✅ Tắt WooCommerce block scripts hoàn toàn (rất nên nếu không dùng cart/checkout block):

add_filter( 'woocommerce_enqueue_block_assets', '__return_false' );

✅ Tắt các style mặc định của Woo (nếu bạn dùng theme tự code):

add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );

🔒 NHÓM 3: Tối ưu bảo mật & header

✅ Tắt wlwmanifest.xml, rsd, generator:

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

🧠 NHÓM 4: Tắt REST API nếu không dùng (cẩn thận):

add_filter( 'rest_enabled', '__return_false' );
add_filter( 'rest_jsonp_enabled', '__return_false' );

❗ Cẩn thận nếu bạn dùng block editor, plugin SEO, hoặc theme cần REST API → không nên tắt hoàn toàn, có thể chỉ giới hạn.


🧰 NHÓM 5: Prefetch, DNS Prefetch, Resource Hints

Đã làm rồi:

add_filter( 'wp_resource_hints', '__return_empty_array', 99 );

📌 Gợi ý thêm:

Bạn muốn tắtGợi ý / Plugin
Thứ gì đang load thừaDùng plugin Query Monitor hoặc Asset CleanUp
Tối ưu script & deferDùng plugin như Perfmatters, Flying Scripts, WP Rocket
Bỏ jQuery nếu không cầnCó thể thay thế bằng Vanilla JS nếu bạn tự code theme