Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for the delay.
You can add the following code snippet to register a new variable that returns the numerical representation of the current month name:
/*
* A snippet to register a custom variable replacement for Rank Math
*
*/
add_action( 'rank_math/vars/register_extra_replacements', function(){
rank_math_register_var_replacement(
'Current_Month_Custom',
[
'name' => esc_html__( 'Current month', 'rank-math' ),
'description' => esc_html__( 'Get and return the current month', 'rank-math' ),
'variable' => 'Current_Month_Custom',
'example' => my_Current_Month_Custom_callback(),
],
'my_Current_Month_Custom_callback'
);
});
function my_Current_Month_Custom_callback(){
return date('m');
}
The variable’s name is %Current_Month_Custom%
And here’s a link to how to apply the filter on your site:
https://rankmath.com/kb/filters-hooks-api-developer/#how-to-add-code-snippets-to-rank-math-php
I hope that helps.
Thank you, and please don’t hesitate to contact us anytime if you need further assistance with anything else.
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.