File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -345,10 +345,14 @@ public static function get_optimization_statistics( $result = null ) {
345345 $ wpdb ->posts .ID,
346346 $ wpdb ->posts .post_title,
347347 $ wpdb ->postmeta .meta_value,
348+ wp_postmeta_file.meta_value AS unique_attachment_name,
348349 wp_postmeta_tiny.meta_value AS tiny_meta_value
349350 FROM $ wpdb ->posts
350351 LEFT JOIN $ wpdb ->postmeta
351352 ON $ wpdb ->posts .ID = $ wpdb ->postmeta .post_id
353+ LEFT JOIN $ wpdb ->postmeta AS wp_postmeta_file
354+ ON $ wpdb ->posts .ID = wp_postmeta_file.post_id
355+ AND wp_postmeta_file.meta_key = '_wp_attached_file'
352356 LEFT JOIN $ wpdb ->postmeta AS wp_postmeta_tiny
353357 ON $ wpdb ->posts .ID = wp_postmeta_tiny.post_id
354358 AND wp_postmeta_tiny.meta_key = ' " . self ::META_KEY . "'
@@ -358,6 +362,7 @@ public static function get_optimization_statistics( $result = null ) {
358362 $ wpdb ->posts .post_mime_type = 'image/png'
359363 )
360364 AND $ wpdb ->postmeta .meta_key = '_wp_attachment_metadata'
365+ GROUP BY unique_attachment_name
361366 ORDER BY ID DESC " ;
362367
363368 $ result = $ wpdb ->get_results ( $ query , ARRAY_A );
You can’t perform that action at this time.
0 commit comments