Created
October 15, 2019 14:46
-
-
Save mtruitt/178296e2ff4176a1bdf0a78cbb55d9f4 to your computer and use it in GitHub Desktop.
Override Yoast breadcrumb links
This file contains hidden or 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
| <?php | |
| add_filter( 'wpseo_breadcrumb_links', 'override_yoast_breadcrumb_links' ); | |
| function override_yoast_breadcrumb_links( $links ) { | |
| global $post; | |
| if ( is_singular( 'post' ) ) { | |
| $breadcrumb[] = array( | |
| 'url' => get_permalink( get_option( 'page_for_posts' ) ), | |
| 'text' => 'Blog', | |
| ); | |
| array_splice( $links, 1, -2, $breadcrumb ); | |
| } | |
| return $links; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment