How to Fix create_function() is deprecated in WordPress

If your WordPress site is rarely updated but you are using the latest PHP version, you might encounter a create_function() is deprecated error message on your website.

As the error message suggests, the create_function() is deprecated error occurs because create_function() is obsolete and no longer used in newer PHP versions. There are two ways for website owners to resolve this error.

How to Fix create_function() is deprecated in WordPress

Actually, the create_function() is deprecated message does not stop the function from running, but it notifies you that the create_function() call is obsolete and you should perform an update.

Depending on the situation, there are two ways to resolve this error.

1. Downgrade PHP Version

Because create_function() has been obsolete since PHP 7.2 and was completely removed in PHP 8.0 and above (Function handling Functions), you can downgrade your PHP version to 7.1 or lower.

If you are using cPanel, you can change your PHP version by following this tutorial: How to Change PHP Version in cPanel.

This method can be used if you do not want the hassle of updating scripts, or if the plugins and themes you are using do not have the latest updates.

2. Upgrade WordPress Core, Plugins, and Themes

If the latest version updates are available for your WordPress core, plugins, or themes, you should perform the updates.

However, there are cases where your website needs to use an older version of WordPress because the plugins or themes you are using have no updates. For example, if you are using premium themes or plugins but have not renewed your subscription, you can only use the older versions of the plugins or themes that were downloaded while your license was still active.

Conclusion

Because this create_function() is deprecated error message is caused by obsolete PHP code, you should update to the latest version, both for your PHP version and your WordPress installation.

As software evolves and updates, more security vulnerabilities can appear in the website or the PHP version being used.

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...