rank_math_register_var_replacement doesn’t work

#513060
  • Resolved Johan W
    Rank Math free

    add_action( 'rank_math/vars/register_extra_replacements', function(){
    rank_math_register_var_replacement(
    'filtered_meta_description',
    [
    'name' => esc_html__( 'Filtered META description', 'rank-math' ),
    'description' => esc_html__( 'Generated META description when using shortcodes.', 'rank-math' ),
    'variable' => 'filtered_meta_description',
    'example' => 'Example META description...',
    ],
    'rankmath_filtered_meta_description()'
    );
    });

    function rankmath_filtered_meta_description() {
    return 'foobar';
    }

    Does not output “foobar” in category description when using %filtered_meta_description%

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thanks for contacting us, and sorry for any inconvenience that might have been caused due to that.

    Please try replacing the current one with the following one instead:

    add_action( 'rank_math/vars/register_extra_replacements', function(){
    	rank_math_register_var_replacement(
    		'filtered_meta_description',
    		[
    			'name' => esc_html__( 'Filtered META description', 'rank-math' ),
    			'description' => esc_html__( 'Generated META description when using shortcodes.', 'rank-math' ),
    			'variable' => 'filtered_meta_description',
    			'example' => 'Example META description...',
    		],
    		'rankmath_filtered_meta_description'
    	);
    });
    
    function rankmath_filtered_meta_description() {
    	return 'foobar';
    }

    Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you.

    Then your documentation is incorrect. Please fix it.

    Hello,

    I’ve already shared the issue to our internal team and we’ll be fixing the issue soon.

    Please do not hesitate to let us know if you need our assistance with anything else.

    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.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘rank_math_register_var_replacement doesn’t work’ is closed to new replies.