Skip to content

Commit

Permalink
Fix/194 PHP Deprecated Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi committed Jun 14, 2024
1 parent 2b8eea9 commit 3cc8bcc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions safe-svg.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ protected function svg_dimensions( $attachment_id ) {
*/
public function disable_srcset( $image_meta, $size_array, $image_src, $attachment_id ) {
if ( $attachment_id && 'image/svg+xml' === get_post_mime_type( $attachment_id ) ) {
// Convert to array if not already to avoid PHP warnings.
if ( ! is_array( $image_meta ) ) {
$image_meta = array();
}
$image_meta['sizes'] = array();
}

Expand Down

0 comments on commit 3cc8bcc

Please sign in to comment.