snip_FetchPriority version 9

add_filter(‘wp_get_attachment_image_attributes’, function ($attr, $attachment) { if (!empty($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false) { // ✅ Optimisations LCP $attr[‘fetchpriority’] = ‘high’; $attr[‘loading’] = ‘eager’; $attr[‘decoding’] = ‘async’; // ✅ Suppression complète des traces de lazyload $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”, $attr[‘class’]);…Continue reading

snip_FetchPriority version 8

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false ) { // Optimisations LCP $attr[‘fetchpriority’] = ‘high’; $attr[‘loading’] = ‘eager’; $attr[‘decoding’] = ‘async’; // Supprimer toute trace lazyload HTML $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”,…Continue reading

snip_FetchPriority version 7

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false ) { // Optimisations LCP $attr[‘loading’] = ‘eager’; $attr[‘fetchpriority’] = ‘high’; $attr[‘decoding’] = ‘async’; // Supprimer toute trace lazyload HTML $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”,…Continue reading

snip_FetchPriority version 6

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false ) { // Optimisations LCP $attr[‘loading’] = ‘eager’; $attr[‘fetchpriority’] = ‘high’; $attr[‘decoding’] = ‘async’; // Supprimer toute trace lazyload HTML $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”,…Continue reading

snip_FetchPriority version 5

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset( $attr[‘class’] ) && strpos( $attr[‘class’], ‘highfetchprio’ ) !== false ) { // Optimisations LCP $attr[‘loading’] = ‘eager’; $attr[‘fetchpriority’] = ‘high’; $attr[‘decoding’] = ‘async’; // Supprimer lazyload (desktop + mobile) if…Continue reading

snip_FetchPriority version 4

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset( $attr[‘class’] ) && strpos( $attr[‘class’], ‘highfetchprio’ ) !== false ) { // Optimisations LCP $attr[‘loading’] = ‘eager’; $attr[‘fetchpriority’] = ‘high’; $attr[‘decoding’] = ‘async’; // Supprimer les classes de lazyload if…Continue reading

snip_FetchPriority version 3

// 1. Modifier les attributs des images avec la classe highfetchprio + supprimer lazyload add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset( $attr[‘class’] ) && strpos( $attr[‘class’], ‘highfetchprio’ ) !== false ) { // Optimisations LCP $attr[‘loading’] =…Continue reading

snip_FetchPriority version 0

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { // Check if the image has the class “highfetchprio” if ( isset( $attr[‘class’] ) && strpos( $attr[‘class’], ‘highfetchprio’ ) !== false ) { $attr[‘loading’] = ‘eager’; $attr[‘fetchpriority’] = ‘high’; $attr[‘decoding’] = ‘async’; }…Continue reading