# Add a LocalBusiness to the Yoast Schema Graph

> Adds a LocalBusiness node with address, phone and opening hours to the Yoast SEO graph on the homepage and links it to Yoast's Organization.

- Type: PHP
- Runs: Frontend only
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: yoast, schema, local-seo
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/yoast-local-business-graph/

## Code

```php
// Your business details.
$wpide_local = array(
    'type'   => 'LocalBusiness',
    'name'   => get_bloginfo( 'name' ),
    'phone'  => '+1-555-010-0199',
    'street' => '123 Main Street',
    'city'   => 'Springfield',
    'region' => 'IL',
    'zip'    => '62701',
    'country' => 'US',
    'hours'  => array( 'Mo-Fr 09:00-17:00', 'Sa 10:00-14:00' ),
    'price'  => '$$',
);

add_filter( 'wpseo_schema_graph', function ( $graph ) use ( $wpide_local ) {
    if ( ! is_array( $graph ) || ! is_front_page() ) {
        return $graph;
    }

    $graph[] = array(
        '@type'          => $wpide_local['type'],
        '@id'            => home_url( '/#localbusiness' ),
        'name'           => $wpide_local['name'],
        'url'            => home_url( '/' ),
        'telephone'      => $wpide_local['phone'],
        'priceRange'     => $wpide_local['price'],
        'openingHours'   => $wpide_local['hours'],
        'parentOrganization' => array( '@id' => home_url( '/#organization' ) ),
        'address'        => array(
            '@type'           => 'PostalAddress',
            'streetAddress'   => $wpide_local['street'],
            'addressLocality' => $wpide_local['city'],
            'addressRegion'   => $wpide_local['region'],
            'postalCode'      => $wpide_local['zip'],
            'addressCountry'  => $wpide_local['country'],
        ),
    );

    return $graph;
} );
```

## Notes

Use a more specific type such as Restaurant or Dentist. Yoast Local SEO users already have this.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Add a LocalBusiness to the Yoast Schema Graph" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
