If your site suddenly shows a critical error and your debug.log mentions UserTemplates::add_template_states(), you are running into a known bug in older WPForms versions:
Fatal error: Uncaught TypeError: Return value of
WPForms\Admin\Forms\UserTemplates::add_template_states()
must be of the type array, null returned
in /wp-content/plugins/wpforms-lite/src/Admin/Forms/UserTemplates.php:116
This does not mean your forms are gone. It means WPForms’ User Templates code in the admin is returning null where PHP now requires an array, so PHP stops the page.
The good news: WPForms has already shipped a fix in version 1.8.8.3 and later. Your job is to get back into the dashboard, update WPForms cleanly, and confirm the error is gone.
My site is crashing with “Fatal error: Uncaught TypeError: Return value of WPForms\Admin\Forms\UserTemplates::add_template_states() must be of the type array, null returned in /wp-content/plugins/wpforms-lite/src/Admin/Forms/UserTemplates.php:116”. How do I fix this?
If you are wondering what is actually broken: your form entries are fine. The crash comes from WPForms’ “User Templates” feature inside the admin returning null instead of an array when WordPress builds the menu and form lists.
In WordPress, the admin screens use a filter called display_post_states to show labels like “Draft”, “Private”, or in this case “Template”. WPForms hooks into that filter with its UserTemplates::add_template_states() method.
That method has a strict return type of array. In some older WPForms Lite versions, there is a path where it simply returns nothing, which becomes null. On modern PHP (PHP 7.4+), that triggers:
Return value of ...UserTemplates::add_template_states()
must be of the type array, null returned
This usually shows up when you:
WPForms support has identified this and fixed it in WPForms Lite 1.8.8.3. Updating is the real fix.
If your site is already back to normal and you can access /wp-admin, skip to Step 2. If not, use one of these paths.
wp-content/plugins/.wpforms-lite folder (or wpforms for Pro) to something like wpforms-lite-temp./wp-admin. WordPress will treat WPForms as deactivated and let you log in.Once you are in the dashboard, leave WPForms disabled until you update it.
Next, move onto a version of WPForms that no longer has this bug.
Now visit the screens that used to crash, for example Appearance → Menus and WPForms → Form Templates (if you use that screen).
If the error is gone: you can skip down to Verification.
If you still see the same fatal error in debug.log: your copy of WPForms may be partially updated or corrupted. Keep going.
A clean reinstall makes sure UserTemplates.php and related files all come from the same current version.
.zip from your WPForms account.If the crash was caused by a half updated plugin folder, this step usually resolves it.
This particular bug is inside WPForms itself, but other plugins or custom code can make it easier to trigger by changing how admin screens query forms and templates.
If the error only appears when a specific add on is active, that add on may be calling internal WPForms methods in a way that hits this bug more often. Keep WPForms up to date and reach out to that add on’s author with the fatal error details.
At this point you have:
If new errors in debug.log still mention:
Return value of WPForms\Admin\Forms\UserTemplates::add_template_states()
must be of the type array, null returned
I will need a bit more context to help you pin it down.
Scroll down, click Continue Chat, and send me:
debug.log file.You are in good shape when:
/wp-admin load without “critical error” messages.debug.log no longer records new entries mentioning:UserTemplates::add_template_states() or Return value must be of the type array, null returned.Hit Continue Chat below and I will help you read your error log, confirm your WPForms version, and decide whether the remaining issue is the plugin, a conflict, or something in your server environment.
Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.
WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!