🛍 Black Friday Sale: MASSIVE Discount + 2x Benefits + $25,000 Worth of Offers for FREE

LEARN MORE!

Support Rank Math Free How to use Rankmath Variables in post content Reply To: How to use Rankmath Variables in post content

Reply To: How to use Rankmath Variables in post content

Nigel
Rank Math business

Hello,

Below is an example that creates the shortcode [rm_title] for the title. You would need to create similar custom functions for other variables:


add_shortcode('rm_title', 'rm_shortcode_title');
	function rm_shortcode_title(){
	$obj = get_queried_object();
	if(is_single()){
		$title =get_post_meta($obj->ID, 'rank_math_title', true); 
		return RankMath\Helper::replace_vars($title);
	}
	if(is_tax()){
		$title = get_term_meta($obj->term_id, 'rank_math_title', true);
		return RankMath\Helper::replace_vars($title);
	}
}