Title: New schema code by AMP
Last modified: May 20, 2021

---

# New schema code by AMP

 *  Resolved [arafail](https://wordpress.org/support/users/arafail/)
 * (@arafail)
 * [5 years ago](https://wordpress.org/support/topic/new-schema-code-by-amp/)
 * Hello!
    We have encountered a new issue with your plugin, after the last update.
   The plugin has added the schema code below, and google has reported that it is
   not valid. We have indeed tested it and it is invalid. – [https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.digitalcitizen.life%2Flatest%2F](https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.digitalcitizen.life%2Flatest%2F)
   How can we remove this code? Thank you!
 * `<script type="application/ld+json">{"@context":"http:\/\/schema.org","publisher":{"
   @type":"Organization","name":"Digital Citizen","logo":{"@type":"ImageObject","
   url":"https:\/\/www.digitalcitizen.life\/wp-content\/plugins\/amp\/assets\/images\/
   amp-page-fallback-wordpress-publisher-logo.png"}},"@type":"BlogPosting","mainEntityOfPage":"
   https:\/\/www.digitalcitizen.life\/5g\/","headline":"What are 5G and its benefits?
   What 5G smartphones are available?","datePublished":"2020-10-10T19:01:47+03:00","
   dateModified":"2020-11-30T10:36:27+02:00","author":{"@type":"Person","name":"
   Ciprian Adrian Rusen"}}</script>`
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fnew-schema-code-by-amp%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [5 years ago](https://wordpress.org/support/topic/new-schema-code-by-amp/#post-14463452)
 * Hello [@arafail](https://wordpress.org/support/users/arafail/),
 * The AMP plugin provides basic structured data that is needed to create a Valid
   AMP page and not meant to fully support it, I will recommend using plugins that
   are specifically created to serve that purpose like Yoast SEO.
 * After checking your page, it seems to be missing a featured image. you can use
   [amp_schemaorg_metadata](https://amp-wp.org/reference/hook/amp_schemaorg_metadata/)
   filter to adjust schema data and add a default placeholder image. (an image that
   represent your site)
 *     ```
       add_filter(
       	'amp_schemaorg_metadata',
       	function ( $metadata ) {
       		$queried_object = get_queried_object();
       		if ( $queried_object instanceof WP_Post ) {
   
       			// Featured image Place holder. if you don't have featured image.
       			$url = 'https://yoursite.com/wp-content/uploads/2020/07/placeholder.jpg';
   
       			if ( has_post_thumbnail( $queried_object ) ) {
       				$url = get_the_post_thumbnail_url( $queried_object );
       			}
       				$metadata['image'] = [
       					'@type' => 'ImageObject',
       					'url'   => $url,
       				];
       		}
       		return $metadata;
       	}
       );
       ```
   
 * If you have other plugin or your theme inserts schema data you can disable AMP
   schema by returning an empty array
 *     ```
       add_filter( 'amp_schemaorg_metadata', '__return_empty_array' );
       ```
   
 * Let me know if that helps!
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [5 years ago](https://wordpress.org/support/topic/new-schema-code-by-amp/#post-14465306)
 * Also, if you have a plugin that adds Schema.org metadata, then the AMP plugin
   won’t add its own. So for example, Yoast SEO adds Schema.org metadata to the 
   page. When this happens, the AMP plugin bypasses adding its own. So you don’t
   have to manually prevent AMP from adding its metadata.
 * As Milind noted, the AMP plugin adds basic Schema.org metadata, so it you want
   more advanced metadata then it is best to use a plugin dedicated for that purpose,
   like Yoast SEO.
 *  Thread Starter [arafail](https://wordpress.org/support/users/arafail/)
 * (@arafail)
 * [5 years ago](https://wordpress.org/support/topic/new-schema-code-by-amp/#post-14465415)
 * Hello!
    Thank you for the code it works perfectly.
 * Our schema is custom added, without any plugins, however here are a few observations:
 * 1: You plugin added a “blogposting” schema to a blog listing page – the page 
   in question is a list of the most recent articles published on that blog.
    2:
   The plugin took the title of the first post in that listing and used it to populate
   it’s schema, which is not really ok. 3: Since there is no featured image on the
   category the plugin added an image from the plugin’s folder, but the schema.org
   tester did not validate that image.
 * Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘New schema code by AMP’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [arafail](https://wordpress.org/support/users/arafail/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/new-schema-code-by-amp/#post-14465415)
 * Status: resolved