• Resolved Rob Watson

    (@rcwatson)


    This plugin is producing this warning message on sites in debug mode

    Warning: Undefined array key “width” in /code/wp-content/plugins/seo-by-rank-math/includes/modules/schema/class-jsonld.php on line 475 Warning: Undefined array key “height” in /code/wp-content/plugins/seo-by-rank-math/includes/modules/schema/class-jsonld.php on line 476

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @rcwatson,
     
    Thank you for contacting Rank Math support, and sorry for any inconvenience that might have been caused due to that.
     
    The issue you mention is most likely related to the Image SEO module and it happens when you have set some image replacements incorrectly or empty under WordPress Dashboard > Rank Math > General Settings > Images: https://rankmath.com/kb/image-seo/#replacements
     
    We recommend checking those and making sure that there’s no empty replacement value in the settings.
     
    Hope that helps.

    Thread Starter Rob Watson

    (@rcwatson)

    I didn’t see any settings with empty or incorrectly set image replacements. I even reset all settings on a test server and the warning still appears.

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @rcwatson,

    We apologize for the previous reply as it’s not accurate.

    The issue is due to the fact that you are using an SVG image for the logo of the website under WordPress Dashboard > Rank Math SEO > Titles & Meta > Local SEO. Given that SVG images don’t have the metadata necessary to extract the width and height, those messages appear on the website.

    You can either ignore the messages or change the image to a format that contains data about the width and height such as JPEG or PNG.

    Don’t hesitate to get in touch if you have any other questions.

    Thread Starter Rob Watson

    (@rcwatson)

    Thank you. I’ve passed this along to the developers.

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @rcwatson,
     
    Sounds good!
     
    If you have any other questions don’t hesitate to get in touch.
     
    We are here to help!

    Hi all.

    I’m searching about this “warning” too. It seems that the image should be png/jpg and not svg, because the function wp_get_attachment_metadata seems that can’t handle the width/height of svgs files. Reviewing the plugin, if i change the lines on the file:

    $entity[‘logo’][‘width’] = $attachment[‘width’];

    $entity[‘logo’][‘height’] = $attachment[‘height’];

    With this

    $entity[‘logo’][‘width’] = (!empty($attachment[‘width’])) ? $attachment[‘width’] : 0;

    $entity[‘logo’][‘height’] = (!empty($attachment[‘height’])) ? $attachment[‘height’] : 0;

    The warning dissapears.

    Don’t know if setting a 0 width / height by default is good, but the warning is solved.

    Best regards

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @lopezacceseo,

    We appreciate you taking the effort to go through the codebase and share your insights. We will pass this along to our developers to gather their feedback on this proposed solution.

    If they decide to implement something like this we will update the plugin soon and credit your solution in our changelog.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Warning: Undefined array key “width”’ is closed to new replies.