Hi, yoast by default add a website schema code to follow the best SEO guidelines. But in my site, I actually use a little extended version of schemas as per my need. But when I looked for a way to remove the website schema code added by yoast seo, i.e.
<script type='application/ld+json'>{ "@context": "http://schema.org","@type": "WebSite","url": "https://www.isaumya.com/","potentialAction": {"@type": "SearchAction","target": "https://www.isaumya.com/?s={search_term}","query-input": "required name=search_term"}}</script>
I didn't find any way to do that. There is option available to disable the person or organization schema code added for knowledge graph. So I disabled it as I use my personal code. But didn't find a way to disable the above code.
Any way to disable it showing in my site source code? Like some remove actions or so. Looking forward to resolvance of this.
There is a 'disable_wpseo_json_ld_search' filter (default false) that can prevent output of this code.
add_filter( 'disable_wpseo_json_ld_search', '__return_true' ); should do it (not tested).
How to disable Yoast SEO Schema JSON-LD completely
function bybe_remove_yoast_json($data){ $data = array(); return $data; } add_filter('wpseo_json_ld_output', 'bybe_remove_yoast_json', 10, 1);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.
Simon snippet works.
Still, it would be better to make it webidiot proof by putting a dashboard setting.
Also, I noticed it also outputs a search section like this:
"potentialAction": {
"@type": "SearchAction",
"target": "http:\/\/www.example.org\/?s={search_term_string}",
"query-input": "required name=search_term_string"
}
But I use a plugin to disable the deafult WP search so that section should also be "optionable" somehow.
Hi Mr SimonHayter i searched google and manywhere found your comment as it is commented here.
Can you please tell me what is that closing tag in functions.php
Most helpful comment