Fix Serialization of Closure is not allowed
What the message means
Serialization of Closure is not allowed means a Closure object reached PHP serialization. A closure represents an anonymous function and cannot be stored using serialize. Look for executable callbacks inside data intended for a session, cache or queue.
The message does not establish that the storage device is full or that a particular plugin is responsible.
Before you change anything
Save the complete error line and its timestamp in a private note. Record the failed action, the active PHP version and any components updated at the same time. Do not post passwords, customer details or full server paths in a public support forum.
Back up both files and the database before making changes. Check that the backup can actually be restored. Use a protected test copy with the same PHP version and relevant settings, with real payments and outgoing customer emails disabled.
Separate code from saved data
A developer can reproduce the error with serialize(function () { return 7; });. Here the function itself is part of the value being stored. Compare that with serialize(['task' => 'export', 'record' => 7]);: this example saves only data for an imaginary task.
The second form does not perform an export. After loading, your application must recognize the task name and map it to a fixed permitted action. Simply dropping a closure can therefore leave an incomplete repair: the queue must still be able to resume its intended task.
Ask for an example that demonstrates both storage and later execution of this one task.
Trace the failing operation
Ask the developer to inspect the object being saved without dumping its complete contents into a public log. Identify the field holding the callback and the code that added it. Establish which data is actually needed to resume the intended action later.
Saving an entire service object is not automatically the right storage design.
Discuss a small data record containing only the necessary information, such as a task name and an invented record identifier. Let the application choose the permitted action when loading that record. Do not turn arbitrary function names from visitor input into executable actions.
Avoid clearing an entire queue to hide the problem: isolate the failed test task and preserve unrelated pending work.
Five steps to repair
- Record the error line and storage operation. Locate the object being serialized and identify the field containing the callback.
- Establish which data must survive for later use. Create a small example using invented values and no executable callback.
- Have the developer separate stored data from execution logic. Limit the repair to the storage path responsible for the failure.
- Test saving and loading in a new request. Verify that the intended task is still available and receives exactly the agreed input.
- Repeat the original action and inspect fresh logs. Also confirm that unrelated queued tasks and session data were not deleted.
A concrete acceptance test
Use an invented export task with a record identifier. Save the required task data, finish the request and reload it during a new request. Let the application select the intended export and inspect the result without generating real customer files.
Test an unknown task name too: it must not execute an arbitrary function. Keep this example with the repair so both storage and resumption remain covered by acceptance checks.
Updating WordPress or WooCommerce components
If the error points to a plugin or theme, first check whether its author documents a relevant update. Record the installed version before trying that update on the test copy. Include any custom extensions that depend on the component in your checks.
Avoid editing supplier files without an agreed maintenance plan. A later update can overwrite a manual repair. For custom code, ask for a change that is kept with the source code and can be tested again during the next PHP update.
When to ask for help
Use the existing PHP update service if you cannot trace the error or if it affects orders, payments or saved records. Describe the failed action and the expected result in the help form below. An error message alone does not identify which component needs to change.
Check your PHP version
Use the Exposure Check link below this article to check your PHP version where it is publicly visible. If that information is unavailable, ask your host to confirm the active version. This check cannot read private logs and does not prove that the programming error is fixed.
Visit the PHP security status page for the separate assessment of your PHP version. Save the versions, code change and test outcome in your maintenance notes. Let the responsible maintainer decide when the tested repair should be applied to the live website.