Skip to content

Instantly share code, notes, and snippets.

@QROkes
Last active February 25, 2016 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QROkes/62e07eb167089c366ab9 to your computer and use it in GitHub Desktop.
Save QROkes/62e07eb167089c366ab9 to your computer and use it in GitHub Desktop.
Some functions to modify Yoast SEO breadcrumbs. (WordPress)
// Add an element after "Home" to Yoast SEO breadcrumbs. (WordPress)
add_filter( 'wpseo_breadcrumb_links', 'qr_add_breadcrumb' );
function qr_add_breadcrumb( $links ) {
$breadcrumb[] = array(
'url' => 'URL',
'text' => 'Text',
);
array_splice( $links, 1, -2, $breadcrumb );
return $links;
}
// Remove "Home" link from Yoast SEO breadcrumbs. (WordPress)
add_filter('wpseo_breadcrumb_links', 'qr_remove_home_breadcrumb');
function qr_remove_home_breadcrumb($links) {
if ($links[0]['url'] == get_home_url()) { array_shift($links); }
return $links;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment