Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Built-in Image Widget using SVG – Size issues

Discussion in 'Misc WordPress Requests' started by davewoodhall, Jan 17, 2018.

  1. davewoodhall


    Built-in Image Widget using SVG – Size issues, by davewoodhall

    In a custom widget area, I’ve added the built-in Image widget and I’m getting the following error :

    Warning: Illegal string offset 'width' in {{PATH_TO_ROOT}} /wp-includes/media.php on line 988

    As a reference, this is what I’m seeing between lines 985 and 999 :

    function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
    if ( $size_name === 'full' ) {
    return array(
    absint( $image_meta['width'] ),
    absint( $image_meta['height'] ),
    } elseif ( ! empty( $image_meta['sizes'][$size_name] ) ) {
    return array(
    absint( $image_meta['sizes'][$size_name]['width'] ),
    absint( $image_meta['sizes'][$size_name]['height'] ),

    return false;

    The issue is with the $image_meta['width'] when using a SVG. It seems to me like it is not storing any information regarding size. I can understand since it is a vector file, but whenever I enable WP_DEBUG I get this problem.

    Thought it would be good to point this out.

    Built-in Image Widget using SVG – Size issues

Share This Page

Monarch Social Sharing Plugin