# Image License Structured Data for Featured Images

> Adds ImageObject JSON-LD with license, credit and copyright details for each post's featured image, which can earn the "Licensable" badge in Google Images.

- Type: PHP
- Runs: Frontend only
- Category: [SEO](https://wpide.com/library/category/seo/)
- Tags: schema, images, copyright
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/seo-image-license-schema/

## Code

```php
// Your image licensing details.
$wpide_image_license = array(
    'license'   => home_url( '/image-license/' ),
    'acquire'   => home_url( '/contact/' ),
    'credit'    => get_bloginfo( 'name' ),
    'copyright' => '© ' . gmdate( 'Y' ) . ' ' . get_bloginfo( 'name' ),
);

add_action( 'wp_head', function () use ( $wpide_image_license ) {
    if ( ! is_singular() || ! has_post_thumbnail( get_queried_object_id() ) ) {
        return;
    }

    $data = array(
        '@context'           => 'https://schema.org',
        '@type'              => 'ImageObject',
        'contentUrl'         => get_the_post_thumbnail_url( get_queried_object_id(), 'full' ),
        'license'            => $wpide_image_license['license'],
        'acquireLicensePage' => $wpide_image_license['acquire'],
        'creditText'         => $wpide_image_license['credit'],
        'copyrightNotice'    => $wpide_image_license['copyright'],
        'creator'            => array( '@type' => 'Organization', 'name' => $wpide_image_license['credit'] ),
    );

    echo '<script type="application/ld+json">' . wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG ) . "</script>\n";
} );
```

## Notes

Point the license and acquire-license URLs at real pages on your site that explain your image terms.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Image License Structured Data for Featured Images" 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/
