Hello,
We apologize for the issue you are facing with the shortcode not working in the Rank Math breadcrumbs. Currently, the [year] shortcode is designed to work in post titles but may not be directly supported in breadcrumbs.
To display the current year in breadcrumbs, you would need to customize the breadcrumb output by modifying the theme files or using a filter. Unfortunately, this requires some coding knowledge.
If you would like to proceed with this customization, you can refer to the following steps:
- Create a custom function that retrieves the current year.
- Use a filter to modify the breadcrumb output to include your custom function.
Here’s a basic example of how you might implement this:
add_filter('rank_math/breadcrumbs', function($crumbs) {
$current_year = date('Y');
// Modify the breadcrumbs array as needed
// Example: $crumbs[] = "Year: $current_year";
return $crumbs;
});
- Add this code to your theme’s
functions.php file or a custom plugin.
Please note that modifying theme files can affect your site, so it’s always a good idea to back up your site before making changes.
If you need further assistance with this customization, we recommend replying to this ticket, and a human agent from the Rank Math Support team will be able to assist you further.
Thank you for raising this concern!
Sources:
Set the Current Year in Post Title Using the [year] Shortcode » Rank Math
Hello,
We checked your post and looks like the breadcrumbs you’re using is not added by the Rank Math plugin. Please note this shortcode will only work if you’re using the breadcrumbs from Rank Math.
Here’s how you can use the breadcrumbs from Rank Math: https://rankmath.com/kb/breadcrumbs/
Hope that helps and please don’t hesitate to let us know if you have any other questions.
Thank you.
Hi,
You’re right, it’s still Genesis breadcrumbs. I turned it off and use your breadcrumbs and it’s working now.
How can we make the shortcode [year] working on Rankmath SEO meta https://ibb.co/ct9Cdmf
I tried but it shows the shortcode instead of the current year.
Best regards,
Tom
Hello,
We are super happy that you’re able to resolve your issue.
If you 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.