Created
August 15, 2020 11:50
-
-
Save vikastyagi87/f8ea884d86d0dd992e5e8b39eaae57cc to your computer and use it in GitHub Desktop.
Illegal string offset ‘width’ and ‘height’ WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this issue occurs when using image uploaded SVGs | |
// Image widgets | |
function wp_get_attachment_metadata_mine($data) { | |
$res = $data; | |
if (!isset($data['width']) || !isset($data['height'])) { | |
$res = false; | |
} | |
return $res; | |
} | |
add_filter( 'wp_get_attachment_metadata' , 'wp_get_attachment_metadata_mine' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment