Skip to content

Instantly share code, notes, and snippets.

@ashhitch
Created December 7, 2020 16:20
Show Gist options
  • Save ashhitch/ace16e2fd3a57116eed2074f579db5ba to your computer and use it in GitHub Desktop.
Save ashhitch/ace16e2fd3a57116eed2074f579db5ba 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