Last active
September 3, 2020 06:49
-
-
Save janneleppanen/3ce10bfb6c42936914be2695ef289f5b to your computer and use it in GitHub Desktop.
Polylang | Yoast | Breadcrumb - Archive link fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fix_breadcrumb_archive_links_lang( $links ) { | |
foreach ( $links as $key => $link ) { | |
if ( isset( $link['ptarchive'] ) ) { | |
$post_type_object = get_post_type_object( $link['ptarchive'] ); | |
$links[$key]['url'] = get_post_type_archive_link( $link['ptarchive'] ); | |
$links[$key]['text'] = $post_type_object->label; | |
} | |
} | |
return $links; | |
} | |
add_filter( 'wpseo_breadcrumb_links', 'fix_breadcrumb_archive_links_lang', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment