Make WordPress Core

Ticket #54464: 54464.diff

File 54464.diff, 774 bytes (added by hasanuzzamanshamim, 3 years ago)

Patch created for width & height validation

  • src/wp-content/themes/twentytwentyone/inc/template-functions.php

    diff --git a/src/wp-content/themes/twentytwentyone/inc/template-functions.php b/src/wp-content/themes/twentytwentyone/inc/template-functions.php
    index 2bee7d6f95..6498c7dfa9 100644
    a b function twenty_twenty_one_get_attachment_image_attributes( $attr, $attachment, 
    457457                $height = (int) $size[1];
    458458        } elseif ( $attachment && is_object( $attachment ) && $attachment->ID ) {
    459459                $meta = wp_get_attachment_metadata( $attachment->ID );
    460                 if ( $meta['width'] && $meta['height'] ) {
     460                if ( isset( $meta['width'] ) && isset( $meta['height'] ) ) {
    461461                        $width  = (int) $meta['width'];
    462462                        $height = (int) $meta['height'];
    463463                }