Skip to content

Instantly share code, notes, and snippets.

@Shoora
Forked from ashhitch/remove-search-yoast.php
Created June 1, 2023 00:43
Show Gist options
  • Save Shoora/bea834f5ce5eba374a7f0c736395e8a5 to your computer and use it in GitHub Desktop.
Save Shoora/bea834f5ce5eba374a7f0c736395e8a5 to your computer and use it in GitHub Desktop.
remove search action Yoast SEO
<?php
add_filter('wpseo_schema_website', 'example_change_website');
function example_change_website($data)
{
if ($data['potentialAction']) {
foreach ($data['potentialAction'] as $key => $value) {
# code...
if ($value['@type'] && $value['@type'] == 'SearchAction') {
unset($data['potentialAction'][$key]);
}
}
}
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment