Google đã chính thức đưa Core Web Vitals vào tiêu chí xếp hạng. Hiểu và tối ưu chúng không chỉ giúp SEO mà còn cải thiện trải nghiệm người dùng.
3 Chỉ Số Core Web Vitals
LCP – Largest Contentful Paint (< 2.5s)
Thời gian render phần tử lớn nhất trên màn hình. Thường là hero image hoặc heading chính.
INP – Interaction to Next Paint (< 200ms)
Thay thế FID từ 2024. Đo khả năng phản hồi của trang với tương tác người dùng.
CLS – Cumulative Layout Shift (< 0.1)
Mức độ dịch chuyển layout bất ngờ. Hình ảnh không có width/height là thủ phạm phổ biến nhất.
Tối Ưu Nhanh Cho WordPress
// 1. Lazy load images
add_filter('wp_lazy_loading_enabled', '__return_true');
// 2. Preload LCP image trong functions.php
add_action('wp_head', function() {
if (is_front_page()) {
echo '<link rel="preload" as="image" href="' . get_template_directory_uri() . '/images/hero.webp">';
}
});
// 3. Tránh CLS - luôn thêm width/height cho ảnh
add_filter('wp_get_attachment_image_attributes', function($attr, $attachment) {
// WordPress tự thêm width/height từ v5.5
return $attr;
}, 10, 2);
Tools Đo Lường
Dùng PageSpeed Insights, Chrome DevTools Performance tab, và Search Console > Core Web Vitals để theo dõi điểm số thực tế.