WordPress 5.9 changes for PHP 8 and 8.1 compatibility

WordPress 5.9 has made some changes for compatibility with PHP 8 and 8.1

WordPress 5.9 PHP changes

Although WordPress 5.9 is not fully compatible with PHP 8.0 and 8.1, below are a few changes that theme and plugin developers need to know.

  • PHP 8 polyfills below are now available in WordPress 5.9

array_key_first()

array_key_last()

str_contains()

str_starts_with()

str_ends_with()

  • readonly() function has been renamed to wp_readonly() in WordPress 5.9
  • Deprecated functions: date_sunrise(), date_sunset(), gmstrftime(), strftime(), strptime()
  • Deprecated hash functions: Hash functions:  mhash(), mhash_keygen_s2k(), mhash_count(), mhash_get_block_size(), and mhash_get_hash_name() .
  • Calling the following on objects is deprecated: key(), current(), next(), prev(), reset(), or end()
  • External libraries included in WordPress 5.9 for PHP 8 and 8.1 support include;

GetID3  1.9.21

SimplePie 1.5.7

PHPMailer 6.5.1

More detailed information is available on this page: WordPress 5.9 changes PHP changes

Do you have any questions about this page or blogging? From starting a blog, marketing, optimization, monetization, management, fixing problems to best tools recommendations. Join our blogging question and answer community and ask us anything? Get answers from professional bloggers and creators. You can register and login to ask questions or do it anonymously without logging in.