Fix “UserTemplates::add_template_states() must be of the type array” Fatal Error in WPForms

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.

Why this error shows up

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:

  • Open Appearance → Menus, or
  • Work with nav menus that include WPForms items, or
  • Load a screen that loops over posts and asks WPForms for template “states”.

WPForms support has identified this and fixed it in WPForms Lite 1.8.8.3. Updating is the real fix.

Step 1: Get back into your dashboard

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.

Option A: Use WordPress Recovery Mode

  1. Check the admin email inbox for a message titled “Your Site Is Experiencing a Technical Issue”.
  2. Click the recovery link in that email.
  3. Log in. WordPress will temporarily pause WPForms so you can reach the dashboard.

Option B: Temporarily disable WPForms via FTP or File Manager

  1. Open your hosting file manager or connect with FTP/SFTP.
  2. Go to wp-content/plugins/.
  3. Rename the wpforms-lite folder (or wpforms for Pro) to something like wpforms-lite-temp.
  4. Reload /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.

Step 2: Update WPForms to a fixed version

Next, move onto a version of WPForms that no longer has this bug.

Do this:

  1. Go to Dashboard → Updates and click Check again.
  2. Go to Plugins → Installed Plugins.
  3. Find WPForms Lite or WPForms (Pro).
  4. If an update is available, click Update now.
  5. Confirm the version is at least:
    • WPForms Lite 1.8.8.3 or higher, or
    • The latest WPForms Pro version if you use Pro.
  6. Reactivate WPForms.

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.

Step 3: Reinstall WPForms cleanly

A clean reinstall makes sure UserTemplates.php and related files all come from the same current version.

Do this (your forms and entries will not be deleted)

  1. In Plugins → Installed Plugins, deactivate WPForms.
  2. Click Delete under WPForms to remove the plugin files.This only removes files. Your forms and entries stay in the database.
  3. Go to Plugins → Add New, search for WPForms, click Install Now, then Activate.
  4. If you use WPForms Pro:
    • Download the latest .zip from your WPForms account.
    • Install it via Plugins → Add New → Upload Plugin, then activate it.
  5. Clear any caching plugin and your host’s cache.
  6. Reload the admin area and the menu or templates screen that used to trigger the error.

If the crash was caused by a half updated plugin folder, this step usually resolves it.

Step 4: Make sure nothing else is fighting WPForms in the admin

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.

Quick conflict check

  1. Go to Plugins → Installed Plugins.
  2. Temporarily deactivate any WPForms related add ons or admin “helper” plugins that:
    • Change the Forms list in the dashboard, or
    • Modify the “Form Templates” or “Starter Templates” experiences.
  3. With only core WPForms active, test:
    • Appearance → Menus
    • WPForms → All Forms
    • WPForms → Form Templates (if available)

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.

If you still see “add_template_states() must be of the type array”

At this point you have:

  • Updated WPForms to a version that includes the fix (1.8.8.3 or later).
  • Reinstalled WPForms from a clean copy.
  • Cleared caches and tested without helper add ons.

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:

  1. The full fatal error line from your debug.log file.
  2. Your versions of:
    • WordPress
    • WPForms Lite and/or WPForms Pro
    • Your PHP version (for example 7.4, 8.1, 8.2)
  3. Which admin screen you were on when the error appeared (Menus, Forms list, Templates, something else).
  4. A quick list of other form or starter template related plugins you have installed.

Verification: how to know it is fixed

You are in good shape when:

  • Your site and /wp-admin load without “critical error” messages.
  • Appearance → Menus and WPForms → Form Templates (if enabled) open normally.
  • debug.log no longer records new entries mentioning:UserTemplates::add_template_states() or Return value must be of the type array, null returned.
  • Only one WPForms plugin is installed and it is on a current version.

Still stuck?

For AI help

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.

For expert human help

Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.

Need human WordPress help?

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!