Unparsable structured data error – Incorrect value type ‘@context’

By | August 14, 2019
Spread the love

Google Search works hard to understand the content of a page. You can help us by providing explicit clues about the meaning of a page to Google by including structured data on the page. Structured data is a standardized format for providing information about a page and classifying the page content; for example, on a recipe page, what are the ingredients, the cooking time and temperature, the calories, and so on.

Google uses structured data that it finds on the web to understand the content of the page, as well as to gather information about the web and the world in general. For example, here is a JSON-LD structured data snippet that might appear on the contact page of the Unlimited Ball Bearings corporation, describing their contact information:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "url": "http://www.example.com",
  "name": "Unlimited Ball Bearings Corp.",
  "contactPoint": {
    "@type": "ContactPoint",
    "telephone": "+1-401-555-1212",
    "contactType": "Customer service"
  }
}
</script>

Recently google has changed data structure tool to validate the page structure via script tag. To fix this error now we need to remove @context from script tag. So correct format will be

<script type="application/ld+json">
{
  "@type": "Organization",
  "url": "http://www.example.com",
  "name": "Unlimited Ball Bearings Corp.",
  "contactPoint": {
    "@type": "ContactPoint",
    "telephone": "+1-401-555-1212",
    "contactType": "Customer service"
  }
}
</script>

To fix this error in wordpress seo plugin, you need to edit following file.

wp-content\plugins\wordpress-seo\inc\class-wpseo-utils.php

public static function schema_tag( $graph, $class = ‘yoast-schema-graph’ ) {
  if ( ! is_array( $graph ) || empty( $graph ) ) {
    return false;
  }

   $output = array(
    //’@context’ => ‘https://schema.org’,
    ‘@graph’ => $graph,
   );
   return “<script type=’application/ld+json’ class='” . esc_attr( $class ) . “‘>” . self::format_json_encode( $output ) . ‘</script>’ . “\n”;
}