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>

16 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!

    Reply
    • You are very welcome. Hopefully one day Yoast will add their own turn off switch.

      Reply
      • Agree with Egan. I do not comment generally. But this was just incredible. One step away of deleting the whole plugin! Thank you so much.

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

    Cheers

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

      Reply
  3. Stephen Jackson

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

    Reply
  4. Mahaha Timmy

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

    Thanks a million BYBE

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

    Reply
  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!

    Reply
  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?

    Reply
  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?

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

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

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

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

    Reply