SEO PHP Intermediate

Add Article JSON-LD Schema to Blog Posts

Last updated: May 6, 2026

Google’s Article rich result is one of the most impactful structured data types for blog-heavy sites. When Google can verify the author, publisher, publication date, and featured image of an article through structured data, it gains confidence in the content’s provenance, and articles with verified metadata are eligible for enhanced presentation in search results, including byline display, date stamps, and image carousels in Google Discover. This snippet outputs Article JSON-LD on every single blog post automatically.

The Code

Add this to your functions.php or a site-specific plugin. It only fires on post post type singles, leaving pages, custom post types, and archives unaffected.

The Schema Properties

headline maps to the post title. Google recommends keeping headlines under 110 characters for optimal rich result display, most post titles fall within this naturally.

description uses get_the_excerpt(), which returns the manual excerpt if one is written, or an auto-generated trimmed version of the content if not. This is the most semantically appropriate field for the description, it represents what the post is about rather than pulling from arbitrary content.

datePublished and dateModified use ISO 8601 format ('c' in PHP’s date format string), which Schema.org requires. The modified date helps Google understand when content was last updated, which is particularly valuable for evergreen articles that are kept current.

The author object uses the Person type with the post author’s display name. For multi-author sites you can enrich this with the author’s URL by adding 'url' => get_author_posts_url( $post->post_author ) to the author array.

The publisher object identifies your organisation and includes your site icon as the logo. get_site_icon_url( 512 ) returns the WordPress site icon (set in Appearance → Customize → Site Identity) at 512px. Google recommends the logo be at least 112px tall for Article schema.

The image Property

The image property is conditionally included only when a featured image is set. Google’s Article rich result guidelines require an image, articles without one aren’t eligible for image-forward rich results. Making it conditional rather than omitting it entirely prevents invalid schema on posts without featured images.

Testing

After adding this snippet, test a post URL in Google’s Rich Results Test at search.google.com/test/rich-results. It will show whether the Article schema is valid and whether the post is eligible for rich result features. Common issues include missing required fields and image dimensions below Google’s minimums (1200px wide recommended for the featured image).

functions.php
add_action( 'wp_head', function() {
    if ( ! is_singular( 'post' ) ) return;

    global $post;
    setup_postdata( $post );

    $author     = get_the_author_meta( 'display_name', $post->post_author );
    $image_url  = get_the_post_thumbnail_url( $post->ID, 'large' );
    $date_pub   = get_the_date( 'c', $post->ID );
    $date_mod   = get_the_modified_date( 'c', $post->ID );
    $logo_url   = get_site_icon_url( 512 );

    $schema = [
        '@context'         => 'https://schema.org',
        '@type'            => 'Article',
        'headline'         => get_the_title( $post->ID ),
        'description'      => get_the_excerpt( $post ),
        'datePublished'    => $date_pub,
        'dateModified'     => $date_mod,
        'author'           => [
            '@type' => 'Person',
            'name'  => $author,
        ],
        'publisher' => [
            '@type' => 'Organization',
            'name'  => get_bloginfo( 'name' ),
            'logo'  => [
                '@type' => 'ImageObject',
                'url'   => $logo_url,
            ],
        ],
    ];

    if ( $image_url ) {
        $schema['image'] = [
            '@type' => 'ImageObject',
            'url'   => $image_url,
        ];
    }

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

Built by Nahnu Plugins

Need something more powerful than a snippet?

Our commercial plugins go further, built for serious WordPress sites with full support, updates, and documentation included.

Browse All Plugins →

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only