Skip to content

Commit dd0e12b

Browse files
Apply suggestions from code review
Co-authored-by: Weston Ruter <[email protected]>
1 parent 4c7faa0 commit dd0e12b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/auto-sizes/hooks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ function auto_sizes_prime_attachment_caches( $content, string $context = null ):
166166
continue;
167167
}
168168

169-
if ( preg_match( '/wp-image-([0-9]+)/i', $class, $class_id ) === 1 ) {
170-
$attachment_id = absint( $class_id[1] );
169+
if ( preg_match( '/(?:^|\s)wp-image-([1-9][0-9]*)(?:\s|$)/', $class, $class_id ) === 1 ) {
170+
$attachment_id = (int) $class_id[1];
171171
if ( $attachment_id > 0 ) {
172172
$images[] = $attachment_id;
173173
}

0 commit comments

Comments
 (0)