# Add a LocalBusiness Entity to Rank Math Schema

> Adds a LocalBusiness node with your address, phone and hours to Rank Math's JSON-LD on the homepage, linked to the site's organization.

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

## Code

```php
// Your business details.
$wpide_rm_local = array(
    'type'    => 'LocalBusiness',
    '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' ),
);

add_filter( 'rank_math/json_ld', function ( $data ) use ( $wpide_rm_local ) {
    if ( ! is_array( $data ) || ! is_front_page() ) {
        return $data;
    }

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

    return $data;
}, 99 );
```

## Notes

Rank Math PRO's Local SEO module does this too; use one or the other.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Add a LocalBusiness Entity to Rank Math Schema" 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/
