-
dear staff how to modify the title of an ahref of breadcrumb ? Because there is not in your code. i attach you a screenshot of my site beautiqline.it here https://ibb.co/X36HGV3
-
Hello,
Thank you for contacting Rank Math and bringing your concern to our attention.
Please try adding the following filter to see if that works for you.
add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) { $crumbs[1][0] = 'ADD YOUR TITLE HERE'; //your title return $crumbs; }, 10, 2);Here’s how you can add filters/hooks to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/Let us know how it goes. Looking forward to helping you.
Thank you.
the tag title in the a href should be the same of the navlink so, according to my screenshot that i send you, it should be “a href=” bla bla bla” title=”COSMETICI”>
Hello,
Can you please confirm if you want to change the URL of the “Cosmetici” breadcrumb? If so, please try adding the following filter:
add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) { $crumbs[1][1] = 'Your URL'; //change the URL here return $crumbs; }, 10, 2);Let us know how it goes.
Thank you.
Nope i want to add the title in the href, the title link in the breadcrumb
Hello,
Please refer to this filter code instead if you wish to modify the attributes of the breadcrumbs element:
add_filter( 'rank_math/frontend/breadcrumb/html', function( $html, $crumbs, $class ) { $html = str_replace('<a href="https://https://beautiqline.it/negozio">Cosmetici</a>', '<a href="https://https://beautiqline.it/negozio" title="COSMETICI">Cosmetici</a>', $html); return $html; }, 10, 3);Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Thanks but i need to apply automatically the titles to all of the breadcrumbs because they missing everywhere 🙂 about seo, the rankmath breadcrumbs have not titles so every seo tools check this error
i changed in the
includes/frontend/class-breadcrumbs.php
the code addingtitle="' . esc_html( $crumb[0] ) . '"at line 145
so it become
$link = $link ? '<a href="' . esc_url( $crumb[1] ) . '" title="' . esc_html( $crumb[0] ) . '">' . esc_html( $crumb[0] ) . '</a>' :but now i need to override it, so when i update the plugin i do not lose the modifies! how? thanks
Hello,
You would have to use the code snippet provided in our previous reply to prevent your changes from being overwritten in a Rank Math update. You may also refer to our full list of breadcrumb related filters if the above filter does not work for you: https://rankmath.com/kb/filters-hooks-api-developer/#breadcrumbs
Hope that helps. Please let us know if you have questions.
I do not understand what previous code
Hello,
If you don’t want the data to get overridden by the updates you need to perform the changes by modifying the filter here: https://support.rankmath.com/ticket/modify-the-title-of-an-ahref-of-breadcrumb/?view=all#post-504020
We understand that the filter is not exactly what you need but we don’t provide custom coding work beyond the basic ones.
Don’t hesitate to get in touch if you have any other questions.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.
The ticket ‘modify the title of an ahref of breadcrumb’ is closed to new replies.