Yoast SEO Guide: How to disable Schema JSON-LD in WordPress

and published
Yoast disable JSON-LD

Yoast SEO is a great little plugin for WordPress, it helps us bloggers and businesses have better search engine visibility by improving the way WordPress presents your data to major search enignes. Yoast SEO packs a punch of awesome features but more notably it adds OpenGraph, Twitter Cards and Rich Snippets Schema.org to your website. Yoast easily allows you to disable and enable both OpenGraph and Twitter cards, but at present does not have an option to disable Schema.

By default Yoast uses “WebSite” and using JSON-LD by W3C, which for the majority of users is absolutely fine, but for Businesses and more advanced users it’s considered very broad and not very specific. Small Businesses such as BYBE will generally want to use something more specific such as “LocalBusiness” rather than “WebSite”. It’s also worth mentioning that Yoast has the option to enable “Organization” which for most of us is not suitable. Organisation should generally be used by larger businesses, clubs, schools and other type of bigger organisations.

In addition to using Yoast using a broad Schema type, the plugin also adds “SearchAction” to the mark-up. If you’re not familiar with Search Action it’s the mark-up that helps search engines add a shiny Sitelinks Search Box below your search engine results. For the majority of webmasters the extra search box is an absolutely fantastic feature but for many it’s not required or wanted, especially if a site only has a few pages or if the site uses a customised search platform that only searches blog posts and not pages.

And with that introduction over its time to move on to a short guide that will provide how to remove Yoast SEO “SearchAction” Sitelinks Search Box and how to disable Yoast SEO Schema JSON-LD completely.

How to disable sitelinks searchbox

There are actually two methods that you can use to prevent the siteLinks searchbox being displayed in the search results.

  1. Add a filter to WordPress that prevents Yoast SEO inserting the code into the JSON-LD script.
  2. Add a Meta tag to your head that informs Google to disable sitelinks searchbox.

Login to your WordPress dashboard and head over to the editor within the tab menu appearance, find your functions file (normally named functions.php) and add the code below just before the PHP tag is closed at the bottom.

add_filter( 'disable_wpseo_json_ld_search', '__return_true' );

The 2nd method is not to remove the JSON-LD SearchAction from the source but rather inform Google not use sitelinks searchbox on your entire site. This is especially handy for those wanting to ensure it never appears on their site, no matter what plugin they decide to install.

Login to your WordPress dashboard and head over to the editor within the tab menu appearance, find your header file (normally named header.php) and add the code below within the <head>..

<meta name="google" content="nositelinkssearchbox" />

How to disable Yoast SEO Schema JSON-LD completely

Login to your WordPress dashboard and head over to the editor within the tab menu appearance, find your functions file (normally named functions.php) and add the code below just before the PHP tag is closed at the bottom.

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

You can validate the code works by visiting Google’s Rich Snippet Testing Tool and using the Fetch URL feature with your full website address. If you have any issues or questions then please use the contact form below.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

49 Responses to “Yoast SEO Guide: How to disable Schema JSON-LD in WordPress”

  1. Dude! Thank you. I was one second away from deactivating the plugin. Don’t be adding no crappy schema to my site yoast without the ability to turn it off!

  2. Finally! a tutorial that is easy to follow and removes the microdata with no issues!


    • This is excellent! my review stars are now showing on Google! but won’t Google punish me for duplicate content?

      • Camila

        Yes they can, it happened to me. I place a review in the footer… bad idea… you have to put it where the actual review is. hope this helps

  3. Stephen Jackson

    Why Yoast doesn’t allow disabling rich snippets within the console is beyond belief. Your code worked perfectly, thanks.

  4. Mahaha Timmy

    Great instructions, it only took me around 10 seconds to install and its disabled Yoast’s JSON.

    Thanks a million BYBE

  5. Thank you so much for writing this. Our customers have been asking for detailed instructions on how to disable their basic markup.

  6. Thanks so much, you saved the day, just what I was looking for all night, I dont usually comment on posts, but just had to say thanks!

  7. Rob McClara

    I am at a loss as to why one would want to disable JSON-LD? From what I understand, that is the format that Google recommends. What am I not understanding?

  8. Jennifer Metro

    Why disable the “website” schema in Yoast? Can’t I just add other, more specific schema to my website as well? I understand I will have to create the schema and place it into my website by myself without the help of this plugin. That is fine by me. But is there something I am missing? Is there some kind of conflict I am unaware of in adding more specific schema to my website?

    • Hi Jennifer, the idea of disable Yoast SEO handling your schema is because you can use your own, more detailed schema. YoastSEO uses https://schema.org/WebSite which isn’t very helpful, your telling Google and other search engines that your a website… gosh, I hope they know that already.

  9. Hi, I have the same problem, but yoast adds structured data using microdata, not json. How can I remove it?

    • Yoast SEO only uses JSON-LD, it sounds like you have a plugin that is adding microdata, many review plugins do this and so on.

  10. You Sir! are awesome! I opted to use https://schema.org/LocalBusiness because its way more relevant than Yoast’s WebSite Schema.

  11. I can’t disable Yoast SEO Schema JSON-LD completely with tutorial code. And I need delete Yoast json+ld because it’s wrong (adds image and description into offers node). I need a more specific implementation for schema.

  12. If the functions.php file is pure .php with no closing tag, will this method still work? I’ve tried adding your code in a various places in the file, but the Rich Snippet Tester keeps showing that pesky schema…..

  13. I would like to stop Yoast from handling my schema data as described above. Just to be clear, this fix (clearly this is a fix that should be an option implemented by Yoast) will only prevent Yoast from handling JSON-LD scheme. It does not disable JSON-LD scheme from being served, Correct? In other words, implementing this fix will not prevent other plugins from serving JSON-LD scripts. Correct?

    A quick shout out for WP SEO Schema for those looking for a plugin solution. Have a look at that for an idea of what a schema plugin should do!

    • I am guessing that this code is no longer valid. When activated it outputs at the top of my admin panel and does not remove the Yoast snippet tool Too bad! I was hoping this would still be a viable solution. Would appreciate hearing from anyone who has a working solution!

      • It still works, this site uses it. Most likely its not enclosed within

         <?php in here, otherwise its processed as HTML ?>
        • Paul McGlade

          Hi great tutorial but Im just wondering is this still a good idea to use the code or will it work? Does anyone know if Yoast plan to update their plugin to match the required standards?

  14. John Henry Gaspay

    I’ve tried to disable Yoast SEO Schema JSON and tried to validate using the validation tool from Google and tried to open in on chrome as guest Schema is still there but on the login browser is no longer there did it remove totally or is it because of the caching.

  15. Great work!

  16. Abhishek Rajput

    I pasted the code as instructed. This code did remove the auto-generated schema on my homepage. However, the schema created by Yoast on my product pages are still present. How do I remove the auto-generated schema on my product pages?

  17. Great post and a big help. I’ve been using this for awhile. However, I just picked up the Yoast Video addon and can’t figure out how to get rid of the json from that. Do you know how? I like the sitemap it provides, but the json isn’t rich enough nor can I change it. Thanks in advance 🙂

  18. The site for my automotive repair business is marked up as “organization”, “local business” and “website” when checking with Google’s tool.

    After implementing this code, “organization” is gone but “website” and “local business” is still there.

    Obviously the local business markup is my desired one, but will the website markup cause conflicts?


    • It should remove both website and organisation. You should then add the schema code you want to use within either header.php using HTML or if you prefer in the functions using PHP.

      It shouldn’t matter but make sure your default is personal, not company. Go to Yoast Dashboard > General Settings:

  19. Christopher

    What is the “bybe” in “bybe_remove_yoast_json” that we are supposed to substitute, our own theme name?

    Thank you.

    • Hi Christopher,

      You can replace bybe with whatever you like. As long as the string is unique and not found anywhere else you can rename the entirely line from:

      • OLD
      • NEW
  20. Christopher Connor

    Here is another filter provided by a user on Stack Overflow to remove ALL Yoast JSON-LD output:

    Add this line to functions.php file:

    add_filter( 'wpseo_json_ld_output', '__return_empty_array' );
  21. Thank you very much. This was very useful.

  22. Hi Simon, I successfully disabled the yoast schema and added my own schema. However, for the home page only, Google testing tool gives me a Detected with no elements. Even though my schema code is correct, google does not show the Entities. Any suggestions? Thanks

  23. Hey. I am running a child theme. Should I put this code in the child theme functions.php or the core theme’s functions.php file? P.S. I put it in the child theme functions.pjp file already and it crashed the site… had to re-install from back up

  24. Juan Maldonado

    Super helpful. I went through the trouble of learning Schema with JSON and was pleased to see you added functionality so that my work wouldn’t get stepped on. This is my favourite WordPress plugin by far, by the way.

  25. Denver Prophit Jr.

    Your function should be wrapped within a plugin active or if a function exists.

    • I suppose you could use if ( ! function_exists( 'wpseo_json_ld_output' ) ) {, but since the later code is a filter it shouldn’t cause any problem if the function exists or not.

  26. Hi,

    Please check is my schema code correct or not storage-4u