PHP 8 in WordPress, what you need to know –

Hosting Mautic QuickStart -50% with support in Spanish
24 hours and free training

Send up to 1,000,000 emails/year. Mautic support in Spanish 24 hours, 365 days

PHP is the programming language in which WordPress is written and is one of the most used on the internet.

In November 2020 it was launched version 8a major version of the language, which includes security improvements, optimization and new features for developers, as well as removes many of the deprecated functions of previous versions.

In this article we will see what it is what this new version means in relation to WordPress and some general recommendations in case you want to use it on your site.

In we already have PHP 8 available, however you have to request it through support tickets so that they enable it in your hosting account.

Should I upgrade to PHP 8?

If you have a production website, the short answer is don’t update. However if you want to test PHP 8 I suggest doing it on a development website or a clone of your site.

Currently WordPress version 5.6 does not yet have full support with PHP 8In fact, on the official WordPress developer site, they name WordPress version 5.6 as “beta compatible with PHP 8”, that is, a version not finished to be compatible with PHP 8.

However, it is certain that future versions of WordPress will already fully support PHP 8.

What could happen if I use PHP 8 with WordPress 5.6?

The core functionality of will continue to work as PHP 8 has compatibility with PHP 7.x, however unexpected bugs could occur on some particular functionality.

See also  Virtuemart virtuemart menu access manager

Also a lot of themes and plugins, which you will possibly use, will not be compatible with PHP 8 yet and might not behave as you expect.

What changes does PHP 8 bring that may affect WordPress?

PHP 8 is stricter than previous versions As for the coding. Previous versions were tolerant of errors that could be made while coding.

Many functions that are part of the core are now strict, for example by requiring the data types in the arguments. This avoids errors in the code due to the data type.

In previous versions, what was a warning is now reported as an error in PHP 8.

Also some functions considered obsolete in previous versions but still functional, were completely removed in PHP 8, some of these are:

create_function() restore_include_path() each()

If you are using a plugin that has not considered the deprecated function warnings in older versions of PHP, and has not been updated, it may not work with PHP 8.

Also keep in mind that many plugins depend on external libraries that should also be updated to PHP 8.

What changes does PHP 8 have in Security?

Older versions of PHP allow comparisons to be loose, being able to compare numbers and letters. ( 0 == “hello” , returns true), this is something known as “Type Juggling”. In PHP 8 comparing integers to strings with the == operator will always return false.

Many exploits or malicious code can take advantage of this functionality in older versions of PHP to bypass validations and perform operations that are not allowed.

See also  IMG carousel

In addition, there is malware that bases its programming on the obsolete functions that we had previously seen and that are now no longer part of PHP 8.

What changes does PHP 8 have in Optimization?

One of the most important features that PHP 8 brings in terms of optimization is the JIT compilation (“Just in time”).

PHP is an interpreted language, that means that it translates the code into machine code while executing the instructions, that is, there is no previous compilation process.

JIT keeps the code that is frequently used compiled, avoiding making the transfer to machine code again and reusing it when necessary, as a result of this process the performance of the code execution in certain repetitive or calculation tasks is increased.

At the WordPress level, JIT optimization is not very noticeable, unless you have a plugin that performs intensive mathematical calculations.

conclusion

PHP 8 is a major version changefuture versions of WordPress will start to support it and this will also drag plugin and theme developers.

Although it will take a while for developers to start adapting and using the new features of PHP 8, it is important to keep an eye on whether the themes and plugins you use on your website will support this new version of PHP.

Also if you are using an old plugin or theme that is no longer supported, maybe it is a good time to evaluate a change.

If you are interested in learning more about PHP, we leave you a link to its .

See also  Insert an Iframe in WordPress -

Help us improve our content by sharing your opinion

WordPress technical support at and regular speaker at Meetups and WordCamps in America.

Loading Facebook Comments ...
Loading Disqus Comments ...