preloader

Adding Review Schema Markup to Your WordPress Site for Star Ratings in Search

Star ratings appearing in Google search results come from structured data markup, specifically the AggregateRating schema type. Here is how to add this to your WordPress site, whether you use a Google Reviews plugin or another review system.

What Schema Markup Produces Star Ratings

Google uses AggregateRating schema — a structured data format that tells Google your business has a specific number of reviews with an average rating. When correctly implemented and verified, Google may display this as star rating rich snippets in search results. Note that Google does not guarantee showing star ratings even with correct schema — it is discretionary.

Schema from Your Review Plugin

Many Google review plugins and SEO plugins output AggregateRating schema automatically when configured. In Rank Math, go to Rank Math, then Schema, then Global Schema and check whether LocalBusiness schema with AggregateRating is being output. In Yoast SEO, check the Knowledge Graph settings under SEO, then Search Appearance, then Knowledge Graph.

Verify the schema output using Google Rich Results Test at search.google.com/test/rich-results. Enter your URL and look for AggregateRating in the detected structured data.

Adding AggregateRating Schema Manually

If your plugin does not output AggregateRating schema, add it manually using a JSON-LD snippet. Add this to your site’s head section via a plugin like Code Snippets or through your child theme functions.php:

function wpwizzy_aggregate_rating_schema() {
    if ( ! is_front_page() ) return; // Only on homepage
    $schema = array(
        '@context'        => 'https://schema.org',
        '@type'           => 'LocalBusiness',
        'name'            => get_bloginfo( 'name' ),
        'url'             => home_url(),
        'aggregateRating' => array(
            '@type'       => 'AggregateRating',
            'ratingValue' => '4.8',  // Your average rating
            'reviewCount' => '47',   // Your review count
            'bestRating'  => '5',
            'worstRating' => '1',
        ),
    );
    echo '<script type="application/ld+json">' . wp_json_encode( $schema ) . '</script>';
}
add_action( 'wp_head', 'wpwizzy_aggregate_rating_schema' );

Update the ratingValue and reviewCount to match your actual Google Business Profile data. Keep these values accurate and up to date — Google may cross-reference them against your actual review data.

Using WooCommerce Product Reviews Schema

For WooCommerce product pages, WooCommerce outputs Product schema with AggregateRating automatically when products have reviews. This is separate from your business/local schema. Verify the product schema on a product page that has reviews using the Rich Results Test.

Important Rules for Review Schema

  • Only markup reviews that are genuine — do not add fake ratings to schema.
  • The ratingValue must be based on actual reviews, not self-assessment.
  • Keep the review count and rating value accurate — update them periodically.
  • Do not add AggregateRating schema to pages that do not actually display reviews.

Violating Google’s structured data guidelines by adding inaccurate review schema can result in manual actions against your site in Google Search Console.

Verifying in Google Search Console

After adding schema, go to Google Search Console, then Enhancements to see whether Google has detected and validated your structured data. Any warnings or errors appear here with specific guidance on what to fix.

For full local SEO schema implementation including LocalBusiness, reviews, opening hours, and service schema, a WordPress developer can implement a complete structured data strategy for your site.

Keep Reading

Previous Post How to Get a Google Places API Key for WordPress Review Plugins Next Post How to Set Up Easy Watermark for Automatic Image Protection

Need Help With Your WordPress Site?

If you need help with WordPress fixes, plugin issues, theme customization, or development work, feel free to get in touch.

Get a Free Estimate