Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Limit the number of words used in bread "crumbs" in Yoast SEO
<?php
/**
* Limit the number of words output in a Yoast SEO bread "crumb"
*
* @param array $crumb The current "crumb" URL and text
*
* @return array
*/
add_filter('wpseo_breadcrumb_single_link_info', function($crumb) {
$word_limit = 3;
$crumb['text'] = wp_trim_words($crumb['text'], $word_limit);
return $crumb;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.