create_function() missing after PHP upgrade
Call to undefined function create_function() means code is attempting to create a function through an old PHPPHP is a programming language that builds your web pages on the computer that hosts your site, just before they reach the visitor. WordPress runs on it. function that is unavailable.
Which PHP version does your site report?
We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.
More about this
You may encounter this when an old themeA WordPress theme is a ready-made package that decides how your WordPress site looks and how its pages are laid out. Change the theme and the design changes. or extension loads on PHP 8.
The filename is the starting point for investigation.
Check which version of that code is active before replacing files or adjusting unrelated settings on the server.
Before you start
Save the complete error line and its timestamp in a private note. Record the action that failed, the current PHP versionA PHP version is a numbered edition of PHP, like 8.3. Each edition is looked after for a limited time, then gets security fixes only, then nothing. and any components updated at the same time. Share only information needed for the investigation.
Public support forums are not suitable places for customer details, access credentials or complete server paths.
Back up both files and the database before making changes. Check that the backupA backup is a separate copy of your website's files and database, so you can bring the site back after a mistake, a hack or a failed update. is usable. Work on a restricted test copy with the same PHP version and relevant settings.
Disable real payments and outgoing customer emails there. Agree who will make the change and who will check the result. These steps are an investigation guide, not a diagnosis of your particular website.
What changed? The PHP manual records create_function() as deprecatedA deprecation is an early warning that a feature still works today but will be removed in a future PHP version, so code using it must be changed in time. in PHP 7.2 and removed in PHP 8.0. It points to anonymous functions as the replacement.
These are functions without a fixed name in the code. The developer needs to preserve the intended behaviour, including input and output. Changing the function name alone does not accomplish that conversion or establish that the application works.
Choosing the correct repair
Ask where the generated function is used later. It might be a callback: a piece of code another routine invokes at an agreed point. The developer should identify the values needed at that moment.
A valid replacement must perform the intended task. A page opening successfully does not prove that a filter or sorting operation still produces the expected result.
Five steps to a repair
- Save the error line and the action immediately before it. Record whether the message appears when opening a page or only after saving a setting. This determines which route to reproduce first.
- Establish who maintains the affected file. Check whether an available update mentions this function. Use a complete release from the supplier rather than replacement files obtained without a clear maintenance source.
- Ask the developer to describe the generated function's input and output. Identify values required from outside that function. This establishes the behaviour the new anonymous function must preserve during the conversion.
- Test the change with small, known examples. For sorting, use a list whose correct order is written down beforehand. Test an empty list separately so a quiet failure cannot pass unnoticed.
- Repeat the original user action and inspect its result. Reopen a saved setting, for example. Then examine the log lines from that particular test and record which code version was checked.
A practical check
One useful scenario is a filter that reduces three visible items to two selected items. Decide beforehand which item should disappear and why. After the repair, compare the output against that expectation.
Also test an input where none of the items qualify. This is a suggested check, not a claim about your pluginA WordPress plugin is an add-on you install in WordPress to give your site extra features, such as contact forms, SEO tools or a webshop.. It gives the developer a way to demonstrate correct callback behaviour instead of only showing that the original error text has disappeared.
Getting help and checking the repair
Use the help form below if you cannot access the logs or do not know who maintains the affected code. Describe one failed action and the expected result. Ask for a proposal that separates the cause, the change and the acceptance check.
Do not include passwords with your request.
After the repair, repeat the original action on the test copy. Also check a normal visitor journey, an empty result and invalid input where relevant. Review fresh log entries at the new test time.
Keep versions and outcomes in your maintenance notes. Let the responsible administrator decide when the tested change can be applied to the live website.
Choosing the next step
Use the links below this article to choose the next step. The PHP update page helps you discuss maintenance with the administrator. The Exposure Check is a separate public check; do not treat its result as evidence that this programming error is repaired.
Use the status page for current security information. Keep the repair of the visitor action and the assessment of the server as separate checks in your notes. When requesting help, include the error text, the failed action and the expected result, but no passwords.
Ask for one responsible person to oversee both the change and its acceptance.