#54526 closed defect (bug) (duplicate)
Twenty Twenty-One: PHP Warning when attachment meta is missing
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.8.2 |
Component: | Bundled Theme | Keywords: | |
Focuses: | Cc: |
Description
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 if ( $meta['width'] && $meta['height'] ) {
… to …
<?php if ( isset($meta['width']) && $meta['width'] && isset($meta['height']) && $meta['height'] ) {
Oliver
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hello,
This issue is already fixed in #54464, which will ship in WP 5.9.