Hello,
Thank you for contacting Rank Math and bringing your concern to our attention.
In this case, you may refer to this filter code below to register a new variable for getting the primary term:
add_action( 'rank_math/vars/register_extra_replacements', function(){
rank_math_register_var_replacement(
'my_primary_term', [
'name' => esc_html__( 'Custom variable name.', 'rank-math' ),
'description' => esc_html__( 'Custom variable description.', 'rank-math' ),
'variable' => 'my_primary_term', /* the actual variable: %my_primary_term% */
'example' => my_primary_term_call_back(),
],
'my_primary_term_call_back'
);
});
function my_primary_term_call_back(){
global $post;
return get_cat_name(get_post_meta( $post->ID, 'rank_math_primary_category', true ));
}
First, you need to add the code above to your website. You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Second, you can use this variable %my_primary_term% to retrieve the primary term.
Hope that helps.
Thank you.
Hello,
Sure! Let us know how it goes.
Meanwhile, please do not hesitate to let us know if you need our assistance with anything else.
Thank you.
Hi, all rigth. Thank you. It have a nice result.
Hello,

You’re welcome.
We are super happy that this issue is already resolved. If you have any other questions in the future, know that we are here to help you.

If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

Thank you.