Last active
June 9, 2023 12:51
-
-
Save nicomollet/dfd07e0d709672cac2e824d5cd7613b7 to your computer and use it in GitHub Desktop.
Yoast SEO Organization Schema Replaced By LocalBusiness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add LocalBusiness to schema Organization | |
* | |
* @api array $data The graph piece to filter. | |
* | |
* @return array | |
*/ | |
function custom_wpseo_schema_organization($data){ | |
$data['address'] = [ | |
'@type' => 'PostalAddress', | |
'streetAddress' => 'My address', | |
'postalCode' => 'My postal code', | |
'addressLocality' => 'City', | |
'telephone' => '0123456789', | |
]; | |
$data['@type'] = 'LocalBusiness'; | |
$data['telephone'] = '0123456789'; | |
$data['image'] = 'pathtoimage'; | |
$data['priceRange'] = '$$'; | |
return $data; | |
} | |
add_filter('wpseo_schema_organization', 'custom_wpseo_schema_organization', 10, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment