rating stars from Rate my Post

#213386
  • Resolved Robert Diana
    Rank Math free

    Dear staff, on my website I use Rate my post plugin to implement it into rank math schema I have added this code :

    add_filter( ‘rank_math/snippet/rich_snippet_softwareapplication_entity’, function( $entity ) {
    $entity[‘aggregateRating’] = [
    ‘@type’ => ‘AggregateRating’,
    ‘ratingValue’ => rmp_get_avg_rating(),
    ‘bestRating’ => ‘5’,
    ‘worstRating’ => ‘1’,
    ‘ratingCount’ => rmp_get_vote_count(),
    ];
    return $entity;
    } );

    in functions.php
    But testing my post in Rich Results test I don’t see any tracks of this code in the Rank Math Schema.
    Here is one of my URL
    https://www.thesaporito.com/borsch-verde-ucraino-zuppa-di-spinaci/

    Could you please check if this code is working on my site? In case if it is not working can you suggest me something to implemnt Rate my post with Rank Math to show star ratings in rich results.

    Last thing I didn’t choose any schema type in Rate my post, because if I choose recipe schema also in that plug in , I get a duplicate schema in structured data.
    Thank you so much.
    Iryna

Viewing 12 replies - 1 through 12 (of 12 total)
  • Ankit
    Rank Math business

    Hello,

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

    It looks like you are using recipe schema inside your web page and the filter is for softwareapplication consider using rich_snippet_recipe_entity instead rich_snippet_softwareapplication_entity.

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

    Dear Ankit, I made the change to the code as you told me ..
    add_filter( ‘rank_math/snippet/rich_snippet_recipe_entity’, function( $entity ) {
    $entity[‘aggregateRating’] = [
    ‘@type’ => ‘AggregateRating’,
    ‘ratingValue’ => rmp_get_avg_rating(),
    ‘bestRating’ => ‘5’,
    ‘worstRating’ => ‘1’,
    ‘ratingCount’ => rmp_get_vote_count(),
    ];
    return $entity;
    } );
    but when I open my site (not homepage but post page)

    it immediately shows me this error, on top of the page

    Warning: Use of undefined constant ‘5’ – assumed ‘‘5’’ (this will throw an Error in a future version of PHP) in /web/htdocs/www.thesaporito.com/home/wp-content/themes/guinevere-theme.1.0.0/functions.php on line 919

    Warning: Use of undefined constant ‘1’ – assumed ‘‘1’’ (this will throw an Error in a future version of PHP) in /web/htdocs/www.thesaporito.com/home/wp-content/themes/guinevere-theme.1.0.0/functions.php on line 920

    what I did wrong?
    Thank you
    Iryna

    Hello,

    Thank you for your patience.

    Could you please try adding the filter through the rankmath.php file? Here’s a step to add a filter:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    Meanwhile, we are checking your code with our development team and will get back to you.

    We would really appreciate your kind patience regarding this matter.

    Looking forward to helping you.

    Thank you.

    Thank you. I will create the file and will insert the code I have posted you before. And I will let you know tomorrow morning.

    Dear team I have just followed your instructions and added the filter as you told me (I have added the root in sensitive data to show you) and it didn’t give me any error.
    But I don’t notice any changes in the rank math recipe schema when I test it in rich results test.
    If I switch on the recipe schema also for Rate my Post plugin , structured data test shows me review snipped but duplicate recipe schema. If I switch it off I see only Rank Math recipe schema and no snippet review.
    What should I do, keep both recipe schemas ON or leave only Rank Math recipe schema ON?
    Waiting for news.
    Thank you
    Iryna

    Hello,

    Thanks for getting back to us.

    If you already have a plugin that includes compliant Schema with the reviews the way you want you can remove the Recipe Schema from Rank Math on your entries to remove the duplication.

    Hope this helps solve your issue.

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

    Thank you for your answer, I want to use Rank Math schema and not the other plugin schema.
    In order to add star ratings to rich snippet can I switch off the rate my post plugin recipe schema and leave only the filter you sent me (that I inserted in rankmath.php as I showed you sensitive data here)?

    How can I check if your filter works properly and adds the star rating in rich snippet?
    Thank you
    Iryna

    …sorry I realized that I didn’t insert the code properly, now I did as it is written in your instructions but it gives me error now. I write the error in sensitive data.
    Please can you help me to correct the code? because now I’m confused completly.
    Thank you
    Iryna

    Hello,

    Thanks for getting back to us.

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello Miguel I have just written the information you need in sensitive data.
    Thank you
    Iryna

    Hello,

    Thanks for getting back to us and sorry for the delayed response.

    The sensitive data section is now cleared and we don’t see any information there. Could you please make sure that you paste the information in the sensitive data section again?

    Looking forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘rating stars from Rate my Post’ is closed to new replies.