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.
@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.
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.