• Resolved Jamie Burchell

    (@jamieburchell)


    My PHP logs are getting spammed with this warning:

    [22-Jul-2026 19:53:37 UTC] PHP Warning: Undefined array key “width” in /var/www/web/app/plugins/seo-by-rank-math/includes/modules/schema/class-jsonld.php on line 479
    [22-Jul-2026 19:53:37 UTC] PHP Warning: Undefined array key “height” in /var/www/web/app/plugins/seo-by-rank-math/includes/modules/schema/class-jsonld.php on line 480

    I understand the issue to be that an SVG is being used as the site logo in the Rank Math settings as mentioned here: https://wordpress.org/support/topic/warning-undefined-array-key-width/

    Since SVGs can be displayed at any dimensions, can Rank Math just omit the dimensions or set an arbitrary value for them?

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Jaideep Asrani

    (@jaideeprm)

    Hello @jamieburchell,

    Thank you for contacting Rank Math support.

    SVG files don’t have a set width and height, and our plugin needs those values to include them in the Schema. Please use a supported format like JPG or PNG as the logo in the Local SEO settings to get rid of the warnings.

    Please do not hesitate to let us know if you need our assistance with anything else.

    Thread Starter Jamie Burchell

    (@jamieburchell)

    @jaideeprm The width and height attributes are optional for the ImageObject in the schema markup, so why not omit them if they are not available instead of not supporting the best format for logos? Especially given RankMath does not prevent the use of an SVG or warn that the logs will be spammed each time a page request is made.

    Plugin Support Jeremy

    (@jeremrm)

    Hello @jamieburchell,

    Thank you for the follow-up, and we appreciate you pointing that out.

    At the moment, our plugin is built around more standard image formats, so we have not yet added specific handling for SVG sizing. That said, this is valid feedback and something we will consider for a future improvement.

    In the meantime, you can use the following filter to remove the width and height properties and stop the warnings from appearing:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    if ( ! isset( $data['publisher'] ) || ! isset( $data['publisher']['image'] ) ) {
    return $data;
    }
    unset($data['publisher']['image']['width']);
    unset($data['publisher']['image']['height']);
    return $data;
    }, 999, 2);

    You can add this code using a plugin like Code Snippets, or in your theme’s functions.php file. For more details on adding filters, please refer to this guide: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Please do not hesitate to let us know if you need our assistance with anything else.

    Thread Starter Jamie Burchell

    (@jamieburchell)

    Thank you.

    Plugin Support Jaideep Asrani

    (@jaideeprm)

    Hello @jamieburchell,

    We are glad that we were able to address your concerns.

    Please do not hesitate to let us know if you need our assistance with anything else.

    Thank you.

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

You must be logged in to reply to this topic.