2026年11月12日
2026年11月12日
WordPress Organization Schema (JSON-LD): Code and Testing Steps
This article is a localized edition of the Japanese original. Read the Japanese original
Organization schema is structured data that tells search engines the name, URL, logo, contact details and other facts about the company or organization that runs a site. You write the Schema.org Organization type in JSON-LD and embed it in the page's HTML. This article shows code that outputs Organization JSON-LD on the home page of a WordPress site, and the steps to check the output.
According to Google's documentation, Organization structured data is one of the signals Google uses to decide on the logo and organization details it shows, for example in knowledge panels. Adding the markup does not guarantee any particular appearance in search results.
Check first: is it already being output?
SEO plugins such as Yoast SEO, Rank Math and All in One SEO, as well as some themes, output Organization structured data (or Person, for personal sites) depending on their settings. If you output the same organization twice from different code and the two disagree, search engines may end up using information you did not intend.
First, check whether the home page HTML already contains Organization.
curl -s https://example.com/ | grep -o '"@type":"Organization"' | head
If this prints anything, prefer entering your organization name and logo in the settings of that SEO plugin or theme. If nothing is printed and you do not want to add a plugin, output it yourself with the steps below. Depending on how the JSON is formatted, it may contain spaces, as in "@type": "Organization", so if nothing shows up, open "View page source" in your browser and search for application/ld+json to be sure.
Main properties for Organization schema
Google's Organization documentation (as of October 2026) has no required properties; it asks you to add the ones that apply to your organization. The commonly used ones are:
| Property | Meaning | Example |
|---|---|---|
name |
Name of the organization | Sample Co., Ltd. |
url |
URL of the organization's official site | https://example.com/ |
logo |
URL of the logo image | https://example.com/wp-content/uploads/logo.png |
sameAs |
URLs of other sites about the organization, such as social media (multiple allowed) | Official X and Facebook pages |
telephone / email |
Main phone number and email address | +81-3-0000-0000 |
address |
Location (PostalAddress type) |
Postal code, prefecture, city, street address |
contactPoint |
Contact desk (ContactPoint type) |
Phone number of the support desk |
legalName |
Registered legal name | Sample Co., Ltd. |
The logo image must be at least 112 x 112 pixels, hosted at a URL Google can crawl and index, and in a format Google Images supports. Google also asks for an image that looks good on a plain white background.
It is enough to place the markup on the home page or on one page that describes the organization, such as an About page. You do not need it on every page.
Code that outputs it in WordPress
If you write this in your theme's functions.php, it disappears when you update or switch themes. It is easier to manage as a theme-independent mu-plugin (Must-Use plugin). PHP files placed in wp-content/mu-plugins/ are loaded automatically without being activated.
# Create the mu-plugins directory if it does not exist (adjust the path to your site)
mkdir -p /var/www/html/wp-content/mu-plugins
nano /var/www/html/wp-content/mu-plugins/organization-schema.php
The file contents are below. Replace the organization name, URLs and other values with your own.
<?php
/**
* Plugin Name: Organization Schema
* Description: Outputs Organization JSON-LD on the home page
*/
add_action( 'wp_head', function () {
// Output only on the home page
if ( ! is_front_page() ) {
return;
}
// If a site logo is set in the Customizer, use that image's URL
$logo_id = get_theme_mod( 'custom_logo' );
$logo_url = $logo_id ? wp_get_attachment_image_url( $logo_id, 'full' ) : '';
$data = array(
'@context' => 'https://schema.org',
'@type' => 'Organization',
'name' => 'Sample Co., Ltd.',
'legalName' => 'Sample Co., Ltd.',
'url' => home_url( '/' ),
'telephone' => '+81-3-0000-0000',
'address' => array(
'@type' => 'PostalAddress',
'postalCode' => '100-0001',
'addressRegion' => 'Tokyo',
'addressLocality' => 'Chiyoda-ku',
'streetAddress' => '1-1-1 Chiyoda',
'addressCountry' => 'JP',
),
'contactPoint' => array(
'@type' => 'ContactPoint',
'telephone' => '+81-3-0000-0000',
'contactType' => 'customer support',
),
'sameAs' => array(
'https://x.com/example',
'https://www.facebook.com/example',
),
);
if ( $logo_url ) {
$data['logo'] = $logo_url;
}
echo '<script type="application/ld+json">'
. wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG )
. '</script>' . "\n";
} );
Key points of the code:
- It builds an array first and converts it to JSON with
wp_json_encode(). Hand-written JSON strings break easily from a missing quote or comma. You cannot write something like->@typeon a PHP object (it is a syntax error), so@typeis written as an array key. JSON_UNESCAPED_UNICODEoutputs non-ASCII text such as Japanese as-is instead of\uescapes, andJSON_HEX_TAGescapes any<>in values so that a</script>cannot break the embedded block.- If you do not use a site logo, delete the
$logo_urllines and write the URL directly, as in'logo' => 'https://example.com/wp-content/uploads/logo.png'. - Delete properties you do not use (you do not publish an address, you have no social accounts, and so on) from the array. There is no need to leave empty values.
- Keep the address and phone number consistent with what your site shows, for example on its company profile page.
After saving, check the file for syntax errors.
php -l /var/www/html/wp-content/mu-plugins/organization-schema.php
If you see No syntax errors detected, the syntax is fine. A syntax error in an mu-plugins file takes the whole site down, so check this especially when you edit directly on the server.
Check the output
See whether it appears in the HTML
Open the home page and check that its source contains application/ld+json and Organization. If you use a caching plugin or server-side cache, clear the cache first.
curl -s https://example.com/ | grep -o '<script type="application/ld+json">[^<]*' | head -c 1000
Validate it with Google’s tools
The old Structured Data Testing Tool has been retired. As of October 2026, these two tools are used:
- Rich Results Test: checks whether the markup can be read as structured data used by Google Search and whether it has critical errors.
- Schema Markup Validator: checks conformance with the Schema.org vocabulary, not limited to Google features.
After publishing, you can use the URL Inspection tool in Google Search Console to see how Google understands the page.
Troubleshooting
- Nothing is output:
is_front_page()is also true when a static page is set as the home page. If it still does not appear, check that your theme's header template callswp_head(). - The logo is missing: unless you set a logo under Appearance → Customize → Site Identity,
custom_logois empty. A logo set through the Site Logo block in a block theme can also be retrieved withget_theme_mod( 'custom_logo' ). - Two Organization blocks appear: your code overlaps with the output of an SEO plugin or theme. Keep only one of them.
- The screen went blank: delete or rename the mu-plugins file over FTP or SSH and the site comes back.
Summary
- First check whether an SEO plugin or theme already outputs Organization. If one does, use its settings
- If you output it yourself, put a PHP file in mu-plugins, turn an array into JSON-LD with
wp_json_encode(), and output it on the home page only - No property is required; include the ones that apply, such as
name,url,logoandsameAs. The logo must be at least 112 x 112 pixels - Test with the Rich Results Test and the Schema Markup Validator
Related articles:
- How to add structured data (schema.org) in WordPress
- Comparing WordPress schema (structured data) plugins
- How to set up LocalBusiness schema in WordPress
Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)