The error is quite self-explanatory. Your last lines are:
add_action( 'wp_ajax_my_action', 'my_action_callback' );
add_filter( 'wpforms_smart_tag_process', 'my_action_callback', 10, 2 );
The action is calling the same function as the filter. But the filter passes two variables and the action only one. The function itself expects two variables:
function my_action_callback($content, $tag)
So if you call the function through the (ajax) action, you get this error. You’ll have to pass $tag
through your ajax call as well. Otherwise my_action_callback
wouldn’t do anything anyway, because it demands $tag
to be 'total'
. Or you could ditch $tag
as a variable, since it is not doing a lot anyway.
Update: you can also make PHP
be more forgiving by adding defaults in the function call:
my_action_callback($content="", $tag='')