2026年11月14日

2026年11月14日

NewsArticle Structured Data in WordPress: Yoast SEO or Custom JSON-LD

This article is a localized edition of the Japanese original. Read the Japanese original

NewsArticle is the schema.org type for a news article. Adding it to a page as JSON-LD tells search engines explicitly that the page is a news article, along with its headline, publish date, modified date, author and images. Google treats three types as article structured data: Article, NewsArticle and BlogPosting.

This article explains how to add NewsArticle to WordPress posts, both with the Yoast SEO plugin and with your own code. Google's requirements follow the "Article structured data" page in Google Search Central as of November 2026.

What to know first

  • It isn't a requirement for appearing in Google News. Google's documentation says no structured data is required to be eligible for Google News features such as Top stories. Structured data helps convey what the page is about accurately.
  • No properties are required. Add the properties that apply to your content. Google recommends the following:
Property Details
headline The article's title. Long titles may be truncated when displayed
image URLs of images that represent the article. Logos aren't allowed. Provide 16:9, 4:3 and 1:1 versions; at least 50,000 pixels (width × height) is recommended
datePublished When the article was first published (ISO 8601; including a time zone is recommended)
dateModified When the article was last modified (same format)
author The author (Person or Organization). List every author if there are several
author.name The author's name only. No job titles or publication names
author.url A URL that identifies the author (such as an author profile page)
  • Don't output article structured data twice on the same page. Many SEO plugins automatically add Article structured data to posts. Before adding your own code, check what structured data the page already outputs.

For writing structured data in general, see also JSON-LD structured data in WordPress.

Method 1: Set the article type to News Article in Yoast SEO

Yoast SEO outputs Article structured data for posts. Change this "article type" to News Article and it is output as NewsArticle.

Change the site-wide default

  1. In the admin, open Yoast SEO → Settings.
  2. Open Content types → Posts and scroll down to the "Schema" heading.
  3. Change the Article type to News Article and click "Save changes".

Changing the default turns every post of that post type into a NewsArticle. Posts where you previously chose a non-default article type individually are not changed.

Change it per post

If your site mixes news and columns, choose the article type for each post in the schema settings of the Yoast SEO meta box (or sidebar) on the post edit screen.

Yoast SEO doesn't output Article for custom post types by default, and the post type must support authors for it to be output. To use it with a custom post type, add the type with the wpseo_schema_article_post_types filter described in Yoast's developer documentation.

Method 2: Output JSON-LD without a plugin

On sites without an SEO plugin, add the following code to your theme's functions.php (a child theme is recommended) or to a code snippets plugin. It outputs NewsArticle in the head of single post (post) pages.

<?php
/**
 * Output NewsArticle JSON-LD on single post pages.
 * Does nothing when Yoast SEO is active, to avoid duplicate output.
 */
add_action( 'wp_head', function () {
	if ( ! is_singular( 'post' ) || defined( 'WPSEO_VERSION' ) ) {
		return;
	}

	$post_id   = get_queried_object_id();
	$author_id = (int) get_post_field( 'post_author', $post_id );

	$data = array(
		'@context'      => 'https://schema.org',
		'@type'         => 'NewsArticle',
		'headline'      => wp_strip_all_tags( get_the_title( $post_id ) ),
		'datePublished' => get_post_time( 'c', true, $post_id ),
		'dateModified'  => get_post_modified_time( 'c', true, $post_id ),
		'author'        => array(
			array(
				'@type' => 'Person',
				'name'  => get_the_author_meta( 'display_name', $author_id ),
				'url'   => get_author_posts_url( $author_id ),
			),
		),
	);

	$image = get_the_post_thumbnail_url( $post_id, 'full' );
	if ( $image ) {
		$data['image'] = array( $image );
	}

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

The key parts of the code:

Part What it does
is_singular( 'post' ) Outputs only on single post pages, not on pages or archives
defined( 'WPSEO_VERSION' ) Skips output when Yoast SEO is active. If you use another SEO plugin, check its output and decide accordingly
get_post_time( 'c', true, ... ) Gets the publish date in ISO 8601 format (UTC, with +00:00)
get_author_posts_url() Uses the author archive page as author.url. An author profile page works too if you have one
get_the_post_thumbnail_url() Uses the featured image as image. Posts without one get no image
JSON_HEX_TAG Keeps a < or > in the headline from breaking the script element

To add it only to news posts, narrow it down by category by adding something like has_category( 'news', $post_id ) to the is_singular( 'post' ) condition.

Check the output

  1. View the page source. Open a post, view its source and search for application/ld+json. Confirm that exactly one NewsArticle (or Article) appears.
  2. Test with the Rich Results Test. Enter the post's URL in Google's Rich Results Test and confirm that "Articles" is detected with no errors. Warnings mean recommended properties are missing, so add the ones that apply to your content.
  3. Check the schema.org format. To validate the syntax, including items Google doesn't use, use the Schema Markup Validator (validator.schema.org).
  4. Use URL Inspection in Search Console. After publishing, use the URL Inspection tool to confirm that Google can fetch the page (that it isn't blocked by robots.txt or noindex).

Google's old Structured Data Testing Tool has been retired. If an article still describes it, switch to the tools above.

How this relates to Google News

Whether a page appears in Google News depends on Google's news policies and the content, not on whether it has structured data. For getting into Google News, see How to get a WordPress site into Google News.

Along with structured data, the following helps convey your article information correctly:

  • Show the headline, publish date and author name on the article page itself (keep the structured data consistent with what the page shows)
  • Make sure dateModified changes when you update the content (it does automatically if you use WordPress's modified date)
  • Create a profile page for each author and use it for author.url

Summary

  • NewsArticle is one of the article structured data types. No properties are required; headline, image, datePublished, dateModified and author are recommended
  • If you use Yoast SEO, changing the article type to News Article is all it takes
  • Without a plugin, output JSON-LD from wp_head, and avoid duplicating an SEO plugin's output
  • Check it with the Rich Results Test and URL Inspection
  • Structured data is not required to appear in Google News

Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)

お気軽にご相談ください

お見積りへ お問い合わせへ
▲