-
When doing the following…
/**
* 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(
‘ait_item_address’,
[
‘name’ => esc_html__( ‘Ait Item Address.’, ‘rank-math’ ),
‘description’ => esc_html__( ‘Custom variable description.’, ‘rank-math’ ),
‘variable’ => ‘ait_item_address’,
‘example’ => get_ait_item_address(),
],
‘get_ait_item_address()’
);
});function get_ait_item_address(){
return ‘address’;
}The following error appears on the front end CPT where I used the variable.
Warning: call_user_func() expects parameter 1 to be a valid callback, function ‘get_ait_item_address()’ not found or invalid function name in C:\Users\richa\Local Sites\directorypro\app\public\wp-content\plugins\seo-by-rank-math\includes\replace-variables\class-variable.php…
The ticket ‘Variable Replacement Callback Function Error’ is closed to new replies.