• Hello,

    Can you please advise how to fix this issue? Or you need to update this theme.

    Jun 08, 07:58:39
    Warning: Undefined array key “width” in /home/mysite.com/wp-content/themes/twentyeleven/image.php on line 39

    Jun 08, 07:58:39
    Warning: Undefined array key “height” in /home/mysite.com/wp-content/themes/twentyeleven/image.php on line 40

    Thanks advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator jordesign

    (@jordesign)

    Hi @cfm168 – could you please check for me if this error still occurs when you have no plugins activated on the site?

    I can find these two warnings when visiting the attachment page for an SVG because WordPress does not set their (full-size) dimensions in metadata.

    Unless you would prefer disabling all image attachment pages, you could try adding a filter to set both SVG dimensions to 0:

    function svg_attachment_metadata_dimensions( $data ) {
    if (
    ( ! isset( $data['width'] ) || ! isset( $data['height'] ) )
    && isset( $data['sizes']['thumbnail']['mime-type'] )
    && $data['sizes']['thumbnail']['mime-type'] === 'image/svg+xml'
    ) {
    $data['width'] = 0;
    $data['height'] = 0;
    }
    return $data;
    }
    add_filter( 'wp_get_attachment_metadata', 'svg_attachment_metadata_dimensions', 10, 1 );
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.