Local Business Schema WordPress Guide for SEO

Local Business Schema / Structured Data is a great way to create rich search results for local business websites. Here’s our Local Business Schema Guide!

If you’ve never heard about Local Business structured data, Local business schema, or structured data in general, here’s a quote for you straight from the documentation:

“When users search for businesses on Google Search or Maps, Search results may display a prominent Google knowledge panel with details about a business that matched the query. When users query for a type of business (for example, “best NYC restaurants”), they may see a carousel of businesses related to the query. With Local Business structured data, you can tell Google about your business hours, different departments within a business, reviews for your business, and more.”

Google

What is Local Business Structured Data?

So Local Business Schema / Local Business Structured Data, is a type of Structured Data. For local business owners, it’s valuable way to add information about their businesses to search results. This improves a site’s SEO and optimises it for indexing in search engines, like Google, Bing, Yandex, etc. Luckily, it’s not difficult to add this type of structured data to a WordPress website. Some examples of types of data we can include in Local Business structured data, are:

  • The business name
  • Images
  • An address (or multiple addresses of departments)
  • Reviews
  • The coordinates of the business
  • The website URL
  • Contact details
  • Opening hours
  • …and lots more!
A screenshot image showing the appearance of Local Business structered data in a rich search results snippet on Google.
The appearance of Local Business strucured data in Google search results.

How to compile Structured Data?

Before we can add the Local Business Schema / Structured Data — which is really just text formatted as JSON — to a website, we need to actually compile all the data we want to include. The documentation provides us with comprehensive examples of how this structured data could (and should) look:

{
    "@context": "https://schema.org",
    "@type": "Restaurant",
    "image": [
        "https://example.com/photos/1x1/photo.jpg",
        "https://example.com/photos/4x3/photo.jpg",
        "https://example.com/photos/16x9/photo.jpg"
    ],
    "name": "Dave's Steak House",
    "address": {
        "@type": "PostalAddress",
        "streetAddress": "148 W 51st St",
        "addressLocality": "New York",
        "addressRegion": "NY",
        "postalCode": "10019",
        "addressCountry": "US"
    },
    "review": {
        "@type": "Review",
        "reviewRating": {
            "@type": "Rating",
            "ratingValue": "4",
            "bestRating": "5"
        },
        "author": {
            "@type": "Person",
            "name": "Lillian Ruiz"
        }
    },
    "geo": {
        "@type": "GeoCoordinates",
        "latitude": 40.761293,
        "longitude": -73.982294
    },
    "url": "https://www.example.com/restaurant-locations/manhattan",
    "telephone": "+12122459600",
    "servesCuisine": "American",
    "priceRange": "$$$",
    "openingHoursSpecification": [
        {
            "@type": "OpeningHoursSpecification",
            "dayOfWeek": [
                "Monday",
                "Tuesday"
            ],
            "opens": "11:30",
            "closes": "22:00"
        },
        {
            "@type": "OpeningHoursSpecification",
            "dayOfWeek": [
                "Wednesday",
                "Thursday",
                "Friday"
            ],
            "opens": "11:30",
            "closes": "23:00"
        },
        {
            "@type": "OpeningHoursSpecification",
            "dayOfWeek": "Saturday",
            "opens": "16:00",
            "closes": "23:00"
        },
        {
            "@type": "OpeningHoursSpecification",
            "dayOfWeek": "Sunday",
            "opens": "16:00",
            "closes": "22:00"
        }
    ],
    "menu": "https://www.example.com/menu",
    "acceptsReservations": "True"
}

A good way to approach this, would be to take one of the examples from the documentation, and modify it where you need. You can remove any of the properties you don’t need, and add any of the missing properties that you do need.

How to add Local Business Schema / Structured Data to your site?

The structured data needs to be added to every page of the <head> of the website of your local business. To continue with the above example taken from the documentation, this is how it would look:

<html>
  <head>
    <title>Dave's Steak House</title>
    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "Restaurant",
      "image": [
        "https://example.com/photos/1x1/photo.jpg",
        "https://example.com/photos/4x3/photo.jpg",
        "https://example.com/photos/16x9/photo.jpg"
       ],
      "name": "Dave's Steak House",
      "address": {
        "@type": "PostalAddress",
        "streetAddress": "148 W 51st St",
        "addressLocality": "New York",
        "addressRegion": "NY",
        "postalCode": "10019",
        "addressCountry": "US"
      },
      "review": {
        "@type": "Review",
        "reviewRating": {
          "@type": "Rating",
          "ratingValue": "4",
          "bestRating": "5"
        },
        "author": {
          "@type": "Person",
          "name": "Lillian Ruiz"
        }
      },
      "geo": {
        "@type": "GeoCoordinates",
        "latitude": 40.761293,
        "longitude": -73.982294
      },
      "url": "https://www.example.com/restaurant-locations/manhattan",
      "telephone": "+12122459600",
      "servesCuisine": "American",
      "priceRange": "$$$",
      "openingHoursSpecification": [
        {
          "@type": "OpeningHoursSpecification",
          "dayOfWeek": [
            "Monday",
            "Tuesday"
          ],
          "opens": "11:30",
          "closes": "22:00"
        },
        {
          "@type": "OpeningHoursSpecification",
          "dayOfWeek": [
            "Wednesday",
            "Thursday",
            "Friday"
          ],
          "opens": "11:30",
          "closes": "23:00"
        },
        {
          "@type": "OpeningHoursSpecification",
          "dayOfWeek": "Saturday",
          "opens": "16:00",
          "closes": "23:00"
        },
        {
          "@type": "OpeningHoursSpecification",
          "dayOfWeek": "Sunday",
          "opens": "16:00",
          "closes": "22:00"
        }
      ],
      "menu": "https://www.example.com/menu",
      "acceptsReservations": "True"
    }
    </script>
  </head>
  <body>
  </body>
</html>

There are multiple ways to add the code to the <head> of your website. You can hardcode the script into the template file that includes your <head>, but—for WordPress sites—a cleaner and more modular approach would be to hook into the wp_head action and add the code as follows:

<?php

add_action( 'wp_head', 'wpsnippets_local_business_structured_data' );

function wpsnippets_local_business_structured_data() {

    ?>
    <script type="application/ld+json">
        {
        "@context": "https://schema.org",
        "@type": "Restaurant",
        ...
        }
    </script>
    <?php

}

How to validate Local Business Schema / Structured Data?

When the structured data is added to your site, you can validate the structured data using the Rich Results testing tool by Google. By doing this, you can be sure that the data is valid, and that it will actually contribute to the appearance of the search results for your local business.

Last updated on May 17, 2023. Originally posted on April 11, 2023.

Leave a Reply

Your email address will not be published. Required fields are marked *