Skip to content

Instantly share code, notes, and snippets.

@amboutwe
Last active December 27, 2019 18:03
Show Gist options
  • Save amboutwe/365558b1eb4a189e9f368255dd2e1504 to your computer and use it in GitHub Desktop.
Save amboutwe/365558b1eb4a189e9f368255dd2e1504 to your computer and use it in GitHub Desktop.
Change labels for select items in Yoast SEO Local
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Yoast SEO Custom label for Business Phone 2
* Credit: Yoast development team
* Last Tested: Apr 28 2017 using Yoast SEO Local 4.6 on WordPress 4.7.4
*/
add_filter( 'wpseo_local_contact_details', 'yoast_local_label_change_phone_2', 10, 1 );
function yoast_local_label_change_phone_2 ( $business_contact_details ) {
foreach( $business_contact_details as $order => $details ) {
if( 'phone_2' === $details['key'] ) {
$business_contact_details[$order]['label'] = 'My new 2nd phone number label';
}
}
return $business_contact_details;
}
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Yoast SEO Local - Custom Search Label
* Credit: Yoast team
* Last Tested: Dec 27 2019 using Yoast SEO Local 12.5 on WordPress 5.3.2
*/
add_filter( 'yoast-local-seo-search-label', 'yoast_local_label_change_search' );
function yoast_local_label_change_search ( $search_label ) {
$search_label = 'Your new search label';
return $search_label;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment