PHOTO-2022-08-06-13-39-03

Getting Your WordPress Plugins and Themes Ready for PHP 8 – WP Tavern

Jonathan Bossenger
On Monday, WordPress core contributor Jonathan Desrosiers published a detailed post on the Make WordPress Core blog about the upcoming PHP 8 release and how it affects WordPress.
Scheduled for release on November 26, 2020, PHP 8 is the next major update to our favorite scripting language. While previous PHP releases have not had too much of an adverse effect on the WordPress ecosystem, this update has some breaking changes that could affect backward compatibility. It should also be noted that many features that were deprecated in PHP 7.x will now be removed in PHP 8.
In his post, Desrosiers highlights the work that has been done to keep the core software up to date. “WordPress Core aims to be compatible with PHP 8.0 in the 5.6 release (currently scheduled for December 8, 2020),” he wrote.
However, this does not mean it is safe to upgrade to PHP 8 when WordPress 5.6 is released. WordPress is rarely run just on its own and usually relies on at least one theme and a collection of plugins to function as a blog or web site. As such, he points out, “The state of PHP 8 support within the broader ecosystem (plugins, themes, etc.) is impossible to know. For that reason, WordPress 5.6 should be considered ‘beta compatible’ with PHP 8.
What this means, essentially, is that until most major themes and plugins are PHP 8 compatible, WordPress cannot be considered fully compatible.
Companies like Yoast have been preparing for this for a little while now. In late October, Yoast CTO Omar Reiss, along with fellow contributors Juliette Reinders Folmer, maintainer of the WordPress Coding Standards Sniffs for PHPCS, and Yoast DevOps manager Herre Groen, compiled and published a comprehensive WordPress/PHP 8 compatibility report.
While I highly recommend you take the time to read through the entire report, it does outline the main reason that the PHP 8 upgrade could have such a drastic effect on large WordPress sites, especially the plugin and theme ecosystem.
“However, PHP 7.* versions have seen a far larger set of deprecations than previous versions of PHP. Where PHP 5.6 to PHP 7 was a relatively simple migration, going from 7.x to 8 could be very painful, especially for very old codebases, like WordPress and many of the plugins that are available for it. For well-typed codebases or codebases which have stayed up-to-date with the latest PHP versions, there isn’t a big problem.”
As a maintainer of a few plugins, some built on code dating back eight years, it is worrisome that this upgrade could cause sites to break.
I asked Reiss and Folmer what plugin and theme developers can do to get ready, and they shared some pointers.
First and foremost, developers should inform themselves about the changes coming in PHP 8: read the Make post about PHP 8, read the Yoast PHP8 Compatibility report, read the “Migrating from PHP 7.4 to PHP 8.0” section of the PHP manual, and potentially dig deeper by reading the UPGRADING doc in the PHP 8 branch and the RFCs for PHP 8.
Some available tools can be used to help look for incompatibilities:
As Desrosiers pointed out in the Make post, WordPress is only officially aiming to be PHP 8 ready by the time 5.6 is released in early December. Potentially, this means that many WordPress-focused hosting companies will only consider offering upgrades to their customers once WordPress core is compatible. So as plugin and theme developers, we have some time to test our products and get them ready, but that window is closing fast.
Fortunately for us, the knowledge and tools to get up to date are out there. We merely need to put them into action.
I’m afraid to upgrade to the same degree I’m excited. While I think my plugins will work well, my theme is a bit outdated but it’s so fast and clean that I don’t want to change.
Not updating for a long time can cause security issues?
Maybe I’ll wait until things are settled and try the update.
Hope everything works fine and we get better performance with this new version. Thank you for the great and informative article.
See ya
Marcos Mariano
Report
Yes, not updating WordPress is a security issue, not updating PHP is another thing. Next WordPress versions will stay compliant with PHP 7 for a while. So you can stay as safe as possible with php7. Plugins and themes developers will have plenty if time to update their products before PHP8 became the minimal requierment. Be careful with your themes deprecations, it become dangerous with the time..
Report
I am often obsessive to the point of being reckless when it comes to keeping software up-to-date. However, I’ll hold off on upgrading to PHP8 for at least six months considering that WordPress sites won’t really see a massive speed boost by upgrading from 7.4.x to 8.
Report
I just recently upgraded to 7.4 and now there’s 8.0 already?
I just can’t seem to keep up with all the major upgrades happening recently.
Report
A smart movement will be to upgrade at the begin of the next year ( Jan, Feb, etc ). Personally, I never update my sites or my client(s) sites with betas, until everything is stable. Ofc, I’ll do an install to see the features and see if there is any problem ( I can find ).
Report
We are happy if php 8 bring lot of performance improvement. It would help me who run small business using WordPress WooCommerce on shared hosting. And next year would be the big challenge when google will implementing web vitals. Hope the compatibility theme and plugin and of course hosting company with php 8 would be ready as soon as posible.
Report
Speed wise what are the benefits of moving to PHP 8?
Report
Without having run any benchmarks yet, I’d say RAM/memory consumption. Depending on your usage, you might see an improvement.
For example, for one of my SaaS’s, I’m running arount 10 nightly CRON jobs, very memory intensive (and slow, as they use cURL). I’m fine with it because it runs at night. I know that, by using PHP 8’s JIT, I would definitely see an up to 20% RAM consumption decrease, which is really good.
Coupling this with a few more updates I’m planning, such as Apache 2.4 and full HTTP/2 cURL, I expect my 10 CRON jobs to be ready in half the time (which is around 10 minutes right now).
Report
Thanks for the read, I was just checking out PHP8 with the current version of WordPress 5.5.3. The backend worked, although there were several issues with themes and plugins. Some hosting companies already offering PHP8, but WordPress is still not ready for that. So do not upgrade quickly even after WordPress releases 5.6.
Report
Your link for “Migrating from PHP 7.4 to PHP 8.0” is currently linking to the WP Make link. I think you meant to link to this: php.net/manual/en/migration80.php
Report
Enter your email address to subscribe to this blog and receive notifications of new posts by email.


WordPress Tavern is a website about all things WordPress. We cover news and events, write plugin and theme reviews, and talk about key issues within the WordPress ecosystem…
© All Rights Reserved. Powered by WordPress, hosted by Pressable

source

Leave a Reply

Your email address will not be published. Required fields are marked *