Hello,
Thank you for contacting Rank Math and bringing your concern to our attention.
Can you please share the URL with us? So that we can check and provide you with a custom code.
Looking forward to helping you.
Hello,
I have updated the sensitive data as requested. Can you please check further? The first link is the link where the “Tempel” in the breadcrumb leads right now, and the second link is where I would like it to go.
Oddly enough, having two categories in the breadcrumb navigation, in this case “Chiang Mai” and “Tempel” makes it so the code previously added to redirect the “Chiang Mai” to a specific page also doesn’t work. If you go on another site however, such as the first one listed in the sensitive data, it works. Any idea why?
Thank you in advance! 🙂
Hello,
In the same function code you can add the following lines for your sub category right above return $crumbs;
:
if ( in_array( 'sub-category-slug', $categories ) ) { // change sub category slug to the correct slug
$crumbs[2][1] = 'your-url'; // Add the desired URL
}
If you look closely you will notice that we have just changed the part of the code from $crumbs[1][1]
to $crumbs[2][1]
for this code to work for the second level of the category which is basically the first sub category.
We hope that helps, and please don’t hesitate to get in touch if you have any other questions.
Thank you.
Thanks Alhan, that worked for the one part of this question! 🙂
However, oddly, the “Chiang Mai” in the breadcrumbs leads to the category page now. This only happens if the breadcrumbs contain a subcategory. If “Chiang Mai” is the only “category breadcrumb”, then it redirects to the page just fine.
You can see the difference by comparing both of my linked pages.
Do you know why that might be?
I’ll also attach a screenshot of the code that’s online now. Thanks in advance!
All sorted now, thanks guys!
Hello,
We are glad we could address your concern.
Please feel free to create a new forum topic if you do have another question in the future.
It will be our pleasure to assist you again.
Thank you.