SoftwareApplication custom code

#352263
  • Resolved Rafael Lorenzoni
    Rank Math free

    Hi there, i was using this custom code for softwareapplication schema

    //SoftwareApplication//

    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;
    }

    It is not working anymore, it generates a critical error in the site now.
    Can you please help me with that?

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

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    The filter has a missing ); at the end. Please use this filter instead:

    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;
    }
    );

    The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    I hope that helps.

    Thank you.

    Worked greatly, thank you!

    Hello,

    You’re welcome.

    We are super happy that this issue is already resolved. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘SoftwareApplication custom code’ is closed to new replies.