Breadcrumb navigation helps users to understand where the current article is located compared to your entire site. In addition, Google and other search engines show it in the search results instead of post URL. So, adding breadcrumbs to WordPress posts becomes an essential part of building internal navigation for your site. The process of adding breadcrumbs in WordPress changes depending upon the theme and plugins you use. If your theme does not offer this feature, then the best option is to use SEO plugins like Yoast SEO or Rank Math. However, one problem with the breadcrumb is to have lengthy post tile in the trail. In this article, we will explain how to remove the post title from breadcrumbs when using Yoast SEO and Rank Math plugins.
Post Title in Breadcrumb
By default, your breadcrumb structure will show the home link, categories and post title. Generally, you will show the structure above post title which could create some of the problems:
- It will be redundant as the title appears multiple times in above the fold area.
- Google will not show post title of the breadcrumb in search result.
- When you have a lengthy post title, it will occupy multiple lines in smaller devices.
The solution here is to remove the repetitive title in the breadcrumb so that it looks simple and occupy less space.
Remove Post Title from Yoast SEO Breadcrumb
Let us first explain removing the title from breadcrumb in Yoast SEO and then in Rank Math plugin. Yoast does not offer any default option for this purpose, you can add the following code in your theme’s functions.php file to achieve this.
- Go to “Appearance > Theme Editor” menu in your admin dashboard.
- Make sure to choose your current theme from “Select theme to edit” dropdown and click “Select” button.
- Select functions.php file from the list of files showing in the right sidebar.
- Add the following code at the bottom of the file.
- Click “Update File” button to save your changes.
/* Remove Post Title from Yoast Breadcrumb */
add_filter('wpseo_breadcrumb_single_link', 'remove_breadcrumb_title' );
function remove_breadcrumb_title( $link_output) {
if(strpos( $link_output, 'breadcrumb_last' ) !== false ) {
$link_output = '';
}
return $link_output;
}
It should look like below in the theme editor.
Many themes like Astra enables automatic integration of Yoast breadcrumb in your site’s layout from customizer settings. Whether you use theme’s settings or manually inserted PHP code to enable breadcrumb, adding the above code in your theme’s functions.php file will remove the title. The result will look as shown in the below picture:
As the changes will be deleted when you update the theme, make sure to use child theme and update the child theme’s functions.php file. Alternatively, use plugins like Code Snippets to insert functions without editing theme’s file.
Remove Post Title in Rank Math Breadcrumb
Rank Math is another SEO plugin that offers similar features like Yoast. You have to manually insert the code in single.php or header.php file to enable breadcrumb from Rank Math plugin. However, the good part is that you do not need to modify functions.php for removing the post title. There is an option available as part of the plugin’s settings which you can make use of.
- Go to “Rank Math > General Settings” menu and navigate to “Breadcrumbs” section.
- Scroll down and and find “Hide Post Title” option and enable it.
- Click “Save Changes” button for the changes to take effect.
Now, check the breadcrumb in your published site and you will not see the post title.
1 Comment
Leave your reply.