Rankmath Strips out tags from product categories

  • I switched over to rankmkath from yoast and like it so far. The only problem I have is that I want to add aggregateRating json-ld markup to the product category and with rankmath enabled the <script>-tag is stripped when saving. I know about the controversial discussion about using json ld on product categories, but still want it. Product categories with no change since rankmath activation still work. Just retried with deactivated rankmath and it works, so it seems a rankmath related problem.

    Can you please help me?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    To be able to add your custom schema on the category pages, I can suggest that you make use of the filter below. You would need to create some custom logic to check if you are on a category page and then inject the custom JSON-LD data.

     * Collect data to output in JSON-LD.
     * @param array  $unsigned An array of data to output in json-ld.
     * @param JsonLD $unsigned JsonLD instance.
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	return [];
    }, 10, 2);

    Looking forward to helping you. Thank you.


    Thanks for your answer. Can you give me an example what I could return?

    I want to add the following json-ld:

    <script type="application/ld+json">
        "@context": "https://schema.org/", 
        "@type": "Product", 
        "name": "xyz",
        "image": "",
        "aggregateRating": {
          "@type": "AggregateRating",
          "ratingValue": "4.78",
          "bestRating": "5",
          "worstRating": "1",
          "ratingCount": "132"

    Thanks in advance!

    Hi Chris,

    As much as we would love to offer customized solution to each and every user we have, it just isn’t possible for a small company like ours with limited resources.

    You can stick to the options offered in the plugin or hire a coder to extend them.


    thanks for your answer. Problem solved: moved back with all my websites to Yoast.

    Kind regards

    Hello Chris,

    We are so sorry to hear that but Yoast doesn’t natively offer that feature either. We are glad your custom solution is working there.

    At the end of the day, you should make your website better regardless of whether you use Rank Math or any other SEO plugin.

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

The ticket ‘Rankmath Strips out tags from product categories’ is closed to new replies.