Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
You can easily register a new custom variable name called %current_month_M% to use on your posts by adding the following code to your theme’s functions.php file:
/**
* A custom replacement variable to get the current month in custom format
*/
add_action( 'rank_math/vars/register_extra_replacements', function(){
rank_math_register_var_replacement(
'current_month_M',
[
'name' => esc_html__( 'Current month', 'rank-math' ),
'description' => esc_html__( 'Current server time displaying month in custom format', 'rank-math' ),
'variable' => 'current_month_M',
'example' => custom_date_callback(),
],
'custom_date_callback()'
);
});
function custom_date_callback(){
return date_i18n( 'M' );
}
Looking forward to helping you. Thank you.
Hi,
First, will %currentmonth% still work or do I need to use another code. As the matter of the fact, I have added %currentmonth% already in all post title tags. So, tell me if I need to replace this with some new code?
Second, as you suggested in this thread https://support.rankmath.com/reply/12120/, you gave two sets of codes. But, in my case, you suggested to insert only one code. Or, do I need to insert another code to override the old one?
Third, I think this is not working as of now, As April should show as APR but it is still showing as April.
Please let me know.
Hello,
Thank you for contacting Rank Math today.
I am sorry if I wasn’t clear in the last response, once you have added this code to your theme’s functions.php you will need to use the replacement variable : %current_month_M% instead of the one you were using to display the short form.
Looking forward to helping you. Thank you.
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.