Skip to main content

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.

[templatera id=”8000″]

24 Comments

  • Vasso Vassiliades Vasso Vassiliades says:

    Will this disable schema if implemented with GTM thereafter?

  • David Elstob David Elstob says:

    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?

  • David Elstob David Elstob says:

    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 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 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 Chad says:

    http://www.theveritasfarms.com

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

    • Prodjex 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 jpungky says:

    it doesnt work, yoast structured data still appears

  • Tim 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 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.

  • mansi mansi says:

    thanks it’s work nice

  • Amazing, it works very well

  • Reza Reza says:

    How to remove schema on single page only?

  • Hi,

    It doesn’t work for the website of my client. I added

    add_filter( ‘wpseo_json_ld_output’, ‘__return_false’ );

    in the functions.php of the theme at the bottom. But in the Google Structured Data Testing tool I still see Yoast..

    https://www.barbara-psychicmedium.com/

    Can someone please help? I don’t understand why it’s not working.

  • web kashan web kashan says:

    thanks its work well.

  • Tried the GTM to stop yoast structure data but it didn’t worked. At the end I installed snip it’s working.

  • Mostofa Mostofa says:

    Hi,

    How can I understand that the code is working or not? Can you please explain? I have already added the code but couldn’t understand, it’s working or not.

  • RSK_Klue RSK_Klue says:

    I tried the code in WP-Config which created an error, then I tried it in functions.php but that did not do anything. Schema in Yoast is still visible. Is there a specific place we need this first code in?

    add_filter( ‘wpseo_json_ld_output’, ‘__return_false’ );

  • gladwin gladwin says:

    thanks alot for this 🙂

Leave a Reply