Skip to content

Instantly share code, notes, and snippets.

@amboutwe
Last active September 24, 2024 23:17
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.
Code snippets to modify the Yoast SEO Local plugin
<?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; // Do not remove
}
<?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; // Do not remove
}
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Disable jquery / JavaScript in Yoast SEO Local
* Credit: Bill Erickson https://www.billerickson.net/
* Last Tested: Unknown
*/
add_filter('wpseo_local_load_jquery', '__return_false');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment