Skip to content

Instantly share code, notes, and snippets.

@ville6000
Last active March 30, 2016 08:23
Show Gist options
  • Save ville6000/3aecd1718554901bf301 to your computer and use it in GitHub Desktop.
Save ville6000/3aecd1718554901bf301 to your computer and use it in GitHub Desktop.
Override Yoast SEO breadcrumb trail
<?php
add_filter( 'wpseo_breadcrumb_links', 'override_yoast_breadcrumb_trail' );
function override_yoast_breadcrumb_trail( $links ) {
if ( get_post_type() === 'employee' ) {
$breadcrumb[] = array(
'url' => get_permalink( get_page_by_title( 'contact' )->ID ),
'text' => __( 'Contact', 'your-text-domain' ),
);
array_splice( $links, 1, 1, $breadcrumb );
}
return $links;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment