Custom Yoast Breadcrumbs URL

Question

I’m trying to change the link in the default Yoast SEO Breadcrumbs.

The current Breadcrumb is

Home / Projects / My Pretty Project

And I want to change the “Projects”, and it’s link, to “Case Studies:

Home / Case Studies / My Pretty Project

This is what I’ve been trying to get working, using the wpseo_breadcrumb_output hook:

add_filter( 'wpseo_breadcrumb_output', 'custom_wpseo_breadcrumb_output' );

function custom_wpseo_breadcrumb_output( $output ){

if( is_single () ){
    $from = '/projects/">Projects</a>';
    $to = '/case-studies/">Case Studies</a>';
    $output = str_replace( $from, $to, $output );
}
return $output;
}

Any help or pointers to get this working?

Thank you!

Edit.. still haven’t got it.

0
, Jamiew 4 years 2019-03-20T00:38:51-05:00 0 Answers 91 views 0

Leave an answer

Browse
Browse