Hello,
Thank you for contacting Rank Math.
You can use the following filter to add custom variables to the titles & meta dropdown:
/**
* Action: 'rank_math/vars/register_extra_replacements' - Allows adding extra variables.
*/add_action( 'rank_math/vars/register_extra_replacements', function(){
rank_math_register_var_replacement(
'custom_variable_slug',
[
'name' => esc_html__( 'Custom variable name.', 'rank-math' ),
'description' => esc_html__( 'Custom variable description.', 'rank-math' ),
'variable' => 'custom_variable_slug',
'example' => 'custom_variable_callback()',
],
'custom_variable_callback()'
);
});
You will need to create a custom_variable_callback function, if you don’t know how to, please get help from a developer.
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.