// When calling a template with get_template_part() set_query_var('my_form_id', 23); get_template_part('my-form-template'); // Inside my-form-template.php $my_form_id = get_query_var('my_form_id');