UPDATED FOR YOAST 11.0+

As of the release of Yoast 11.0 on April 16th, 2019 you should use the below snippet to remove the Yoast Schema data:

add_filter( 'wpseo_json_ld_output', '__return_false' );

 

PRIOR TO YOAST 11.0

Yoast SEO is our favorite SEO plugin for WordPress.  It helps you customize all of your search engine data at the page, post and site levels easily.  One thing Yoast now includes is a generator for JSON-LD Schema Data.  It generates it on the fly and inserts into your webpage.  Schema Data is a great way to let search engines know what your page is about.

By default Yoast doesn’t include a setting to disable their Schema Data.  They do an OK job constructing it but some of you may want to disable it completely if you’re using another plugin or method to generate it.

Open your functions.php file from your child theme and drop in this little snipped of code the the last line.

function disable_yoast_schema_data($data){
	$data = array();
	return $data;
}
add_filter('wpseo_json_ld_output', 'disable_yoast_schema_data', 10, 1);

Save the file and refresh you page, the Yoast Schema Data has been removed from your site.

If you’re running WooCommerce keep in mind it also generates Schema Data.  We wrote an article on How to Remove the Woocommerce JSON/LD Structured Data Format.

15 Comments

  • Vasso Vassiliades says:

    Will this disable schema if implemented with GTM thereafter?

  • 1. I’m missing the AMP Publisher logo and getting an error on every post.
    2. Running Yoast, Yoast Glue, and now a Schema plugin.
    3. It seems I have two lots of JSON-LD one in the body – correct – and one in the footer – incorrect.
    4. Google seems to be reading the last one unfortunately.
    5. I have tried turning off Yoast, plus other plugins, but the JSON-LD in the footer persists.
    6. Tried your code above, but it didn’t seem to work – I have a child theme.
    7. I’m puzzled. Any ideas, please?

  • Sorry, I didn’t realise that Yoast and Yoast Glue both submit JSON-LD so I have turned Glue off and I think it works. Thanks so much!!!

  • Chad says:

    This doesn’t seem to be disabling for me as the organization schema is still showing up when validating with the Schema tester. But I may have entered it wrong in my functions.php. Here’s how it looks:

    <?php
    function disable_yoast_schema_data($data){
    $data = array();
    return $data;
    }
    add_filter('wpseo_json_ld_output', 'disable_yoast_schema_data', 10, 1);

    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;

    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED – Do not modify or remove comment markers above or below:

    // END ENQUEUE PARENT ACTION

    • Prodjex says:

      I’d bet it’s WordPress or WooCommerce doing this if you have it enabled as well. What’s your website URL?

  • Chad says:

    http://www.theveritasfarms.com

    We’re not using Woocommerce, so it’s either WP or Yoast.

    • Prodjex says:

      Interesting, just took a look and it must be another plugin injecting this code or it’s defined in your template.

      Have you checked the header template file to ensure this isn’t hard-coded?

  • jpungky says:

    it doesnt work, yoast structured data still appears

  • Tim says:

    There is also a plugin to disable Yoast schema called Remove Schema. It can also remove schema markup from other plugins.
    It’s possible to remove it from all pages or just from a specific page.

    https://wordpress.org/plugins/remove-schema/

    • Prodjex says:

      Hey Tim, nice find!

      Looks like a relatively new plugin, but will help people for sure if it works correctly that don’t want to modify at the code level.

      Have you taken a look to see if it is a light-weight plugin or bloated? Just curious if it slows down page loads with a lot of extra code or if it’s nice and light-weight.

Leave a Reply