variable %currentmonth% custom

  • Hi Admin, I have 2 issues I want to get help when I can’t find any answers on the RM forum.
    1. I use the %curentmont% variable to display the current month on the title, it works, however I want to change their display, I’m Vietnamese. When using this variable it displays “Tháng Tám”, I want them to display “8” instead of “Tháng Tám”. How do I use the filter now?
    2. Schema issue: Previously I used Yoast SEO, now the schema structure is changed and does not display the description properly (the content only displays the post_title and post_excerpt variables), the image file is attached: How should I deal with it now?
    We look forward to hearing from you soon!

    • This topic was modified 3 years, 3 months ago by Le Hieu.
Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today and sorry for the delay.

    1). You can work around this issue by registering a custom replacement variable that will output only the month number. Here is some code that you can add to your theme’s functions.php file to achieve this:

    add_action( 'rank_math/vars/register_extra_replacements', 'register_custom_rep' );
    function register_custom_rep() {
    				'name'    => esc_html__( 'Current Month', 'rank-math' ),
    				'desc'    => esc_html__( 'Current server month', 'rank-math' ),
    				'example' => current_time( 'F' ),
    	function get_current_month_custom() {
                    if ( ! isset( $replacement ) ) {
    			$replacement = date('n');
    		return $replacement;

    You will then need to replace the usage of %current_month% with %current_month_custom%

    2). This suggests that some variables were not successfully migrated to Rank Math. You can fix this by adding the following code to your theme’s functions.php file to replace the variables with their values.

     * Override the current Rank Math headline and description on arcticle snippet
     * @param array $entity Snippet Data
     * @return array
    add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
    	global $post;
    	$entity['headline'] = get_the_title();
    	$entity['description'] = wp_html_excerpt(strip_shortcodes( $post->post_content ), 155 );
    	return $entity;

    Looking forward to helping you. Thank you.



    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.

Viewing 1 replies (of 1 total)

The ticket ‘variable %currentmonth% custom’ is closed to new replies.