• Resolved Konstantin

    (@k0stell0)


    Hi Rank Math team,

    I’d like to report what appears to be a schema output issue.

    I found a couple of cases where numeric schema values seem to be created correctly at first, but in the final JSON-LD output they are converted into strings instead of remaining numbers.

    Examples from live output:

    • BreadcrumbList.itemListElement[].position becomes "1" instead of 1
    • ImageObject.width / height become "512" instead of 512

    From testing and tracing the plugin code, the issue seems to happen in the final schema rendering pipeline:

    • includes/modules/schema/snippets/class-breadcrumbs.php – breadcrumb position appears to be created as an integer
    • includes/modules/schema/class-jsonld.php – the final graph appears to be passed through wp_kses_post_deep() before wp_json_encode()

    Based on testing, that final step seems to convert numeric values into strings before the JSON-LD is printed. I only confirmed this in a couple of numeric fields, but it may be affecting other numeric values in the schema output as well.

    It may be worth checking whether the final sanitization step in includes/modules/schema/class-jsonld.php preserves numeric values instead of converting them into strings before output.

    Thanks for taking a look.

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

    (@jaideeprm)

    Hello @k0stell0,

    Thank you for contacting Rank Math support.

    Google’s parsers are designed to handle both formats interchangeably. Since the official Schema Validator and Rich Results testing tools do not report any errors or warnings for this, it will not cause any issues with your SEO or rich snippet eligibility.

    The values are currently processed through wp_kses_post_deep as a security measure to prevent XSS (Cross-Site Scripting) vulnerabilities. While this results in the numeric value being wrapped in quotes, it ensures the data remains safe and valid for search engines.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.