Change yoast breadcrumb text and url

Here is an easy way to change the text and url of yoast breadcrumb for the parent. Usually this is linking to archive of the post type. My example is for singular but you can adapt it to suit your use case.

add_filter('wpseo_breadcrumb_links', 'yoast_change_breadcrumbs');
function yoast_change_breadcrumbs($links) {
//calendar-events custom post type
	if(is_singular('calendar-events')) {
//note the index
		$links[1] = array('text' => 'Kalender', 'url' => '/kalender/', 'allow_html' => 1);
	}
	return $links;
}

Leave a reply:

Your email address will not be published.

Site Footer