-
Hello, can I hide the title from breadcrumbs for post
is_single()
only and let it show for pageis_page()
?Thank you
-
I have tried this filter and works, but the last item (the category or taxonomy) is not clickable, how to fix it?
add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) { if(is_single()){ array_pop($crumbs); } return $crumbs; }, 10, 2);
Hello,
Thank you for contacting Rank Math and bringing your concern to our attention.
Please try replacing the code you’ve written with the following one to see if that works for you:
add_filter( 'rank_math/frontend/breadcrumb/settings', function( $settings ) { global $post; if ( is_single() ) { $settings = array('remove_title' => true); } return $settings; });
Here’s how you can add filter/hooks to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.
Thank you.
The code you provided works fine and I just add another filter to change separator breadcrumbs before it, but not executed, any problem?
add_filter( 'rank_math/frontend/breadcrumb/settings', function( $settings ) { $settings = array( 'separator' => '<i class="fa-solid fa-chevron-right"></i>' ); return $settings; }); add_filter( 'rank_math/frontend/breadcrumb/settings', function( $settings ) { global $post; if ( is_single() ) { $settings = array('remove_title' => true); } return $settings; });
Hello,
The separator settings you added will not take effect since you have overridden it with new settings to remove the title.
You may refer to this filter code instead:
add_filter( 'rank_math/frontend/breadcrumb/settings', function( $settings ) { if ( is_single() ) { $settings = array( 'separator' => '<i class="fa-solid fa-chevron-right"></i>', 'remove_title' => true ); }else{ $settings = array( 'separator' => '<i class="fa-solid fa-chevron-right"></i>' ); } return $settings; });
Let us know if this works on your end.
Looking forward to helping you.
Well done, thank you for excellent support.
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.
Hi,
I had the issue and fixed after adding the filter code.
However, my Page titles in the breadcrumbs are also non-linkable. I wonder how it can be fixed?
Please ignore my post. All good now 🙂
Hello @thomastsui,
Glad that the issue is resolved.
Please feel free to reach out to us again in case you need any other assistance.
We are here to help.
Thank you.
The ticket ‘Hide title from breadcrumbs (for post type only)’ is closed to new replies.