[wp-trac] [WordPress Trac] #54526: Twenty Twenty-One: PHP Warning when attachment meta is missing
WordPress Trac
noreply at wordpress.org
Sat Nov 27 07:57:32 UTC 2021
#54526: Twenty Twenty-One: PHP Warning when attachment meta is missing
---------------------------+-----------------------------
Reporter: domainsupport | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bundled Theme | Version: 5.8.2
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
When an attachment doesn’t have “width” or “height” meta (for whatever
reason), the following PHP error is shown …
> PHP Warning: Undefined array key "width" in /wp-
content/themes/twentytwentyone/inc/template-functions.php on line 460
I think that this line in template-functions.php be changed from …
{{{#!php
<?php
if ( $meta['width'] && $meta['height'] ) {
}}}
… to …
{{{#!php
<?php
if ( isset($meta['width']) && $meta['width'] && isset($meta['height']) &&
$meta['height'] ) {
}}}
Oliver
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54526>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list