Skip to content

Instantly share code, notes, and snippets.

@jdevalk
Last active January 6, 2022 04:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdevalk/72bf00d8ba2d7a6144b9a35f0f4dd5b1 to your computer and use it in GitHub Desktop.
Save jdevalk/72bf00d8ba2d7a6144b9a35f0f4dd5b1 to your computer and use it in GitHub Desktop.
This is how to add the copyrightHolder schema to the Website Schema piece Yoast SEO outputs.
<?php
add_filter( 'wpseo_schema_website', 'example_change_website_schema', 10, 2 );
/**
* Changes the Yoast SEO Website schema.
*
* @param array $data The Schema Website data.
* @param Meta_Tags_Context $context Context value object.
*
* @return array $data The Schema Website data.
*/
function example_change_website_schema( array $data, Meta_Tags_Context $context ): array {
$data['copyrightHolder'] = [ '@id' => $context->site_url . Schema_IDs::ORGANIZATION_HASH ];
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment