-
Hello,
I have an ACF field that I would like to add to the meta title of a taxonomy archive dynamically.
I have reinterpreted a piece of code I found in the Rank Math support answers.
The new variable was indeed created in the Rank Math drop-down menu: %title_h1%.
But it returns –> title_h1_callback() | (sitename)Here is my code:
/**
* 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(
'titre_h1',
[
'name' => esc_html__('titre champs personnalisé ACF', 'rank-math'),
'description' => esc_html__('titre h1 de la page du tag', 'rank-math'),
'variable' => 'titre_h1',
'example' => 'titre_h1_callback()',
],
'titre_h1_callback()'
);
});function titre_h1_callback()
{
return 'titre_h1';
}
I’m probably missing something simple, but if you could tell me where I’m going wrong, that would be great.
Best,
Priscilla
You must be logged in to reply to this ticket.