When you create a contract from MainWP, the addon builds a variable map from the selected Client and Site, then applies it through WPSigner’s form/template prefill helper (FormFeedFieldPrefill::apply_variables).
Empty values are stripped before apply. History meta records whether prefill matched (variables prefilled / no prefill match).
How Matching Works
Section titled “How Matching Works”- Name template fields (or mapping names) using the keys below — same idea as form feeds / Zapier mapping in WPSigner.
- Create from MainWP with a Client and/or Site selected.
- Matching keys receive values automatically on the new document.
If only a Site is selected and that Site has a linked MainWP client_id, the addon infers the Client for variable building.
Built-in Keys
Section titled “Built-in Keys”| Key | Source |
|---|---|
client_name | MainWP client name |
client_email | MainWP client email |
site_name | Site name |
website_name | Alias of site_name |
site_url | Site URL |
website_url | Alias of site_url |
property_address | Currently filled with the site URL (convenient alias for address-style fields) |
date | Today as Y-m-d (site timezone via wp_date) |
today | Same as date |
appointment_date | Same as date |
current_date | Human-readable date using WordPress date_format |
mainwp_client_id | Client ID as string (empty if none) |
mainwp_site_id | Site ID as string (empty if none) |
Developer Filter
Section titled “Developer Filter”Extend or override the map:
/** * @param array<string,string> $vars * @param int $client_id * @param int $site_id */add_filter('imwp_template_variables', function ($vars, $client_id, $site_id) { // Example: add a custom CRM ID stored on the client. if ($client_id) { $vars['crm_id'] = (string) get_option('my_crm_id_' . $client_id, ''); } return $vars;}, 10, 3);Return only string values. Empty strings are removed before apply.
Troubleshooting Prefill
Section titled “Troubleshooting Prefill”| Symptom | Fix |
|---|---|
| History says no prefill match | Field mapping names do not match keys; or Client/Site had no usable values |
| Client fields empty | Select a Client, or ensure the Site has a linked client |
| Site URL missing | Select a Site with a valid URL in MainWP |
| Custom key ignored | Add it via imwp_template_variables and map the template field to that name |
More help: Troubleshooting.
Related
Section titled “Related”- Creating Contracts
- Form Fields — field name / mapping name in the PDF editor
- WPSigner for MainWP overview