-
I have created a custom variable following the instructions, but it is printing markup into my header instead of the meta description.
add_action('rank_math/vars/register_extra_replacements', function () {
rank_math_register_var_replacement(
'merchant',
[
'name' => esc_html__('Merchant', 'rank-math'),
'description' => esc_html__('Displays the current seller of a product', 'rank-math'),
'variable' => 'merchant',
'example' => merchant_callback(),
],
'merchant_callback'
);
});
function merchant_callback()
{
global $post;
$itemsync = \ContentEgg\application\WooIntegrator::getSyncItem($post->ID);
if(!empty($itemsync)) {$merchant =\ContentEgg\application\helpers\TemplateHelper::getMerhantName($itemsync,true);
$html .= '';
return $html;}
}
Could you give me any pointers to correct it??
Thanks
The ticket ‘Custom Variable Printing In Header’ is closed to new replies.