PHP 8.5 deprecated warnings in WordPress: what they mean and the fix

PHP 8.5 deprecated warnings

THE SHORT ANSWER

PHP 8.5 deprecated warnings are notices, not errors. The site still runs. They mean a plugin or theme uses code that a future PHP version will remove. Fix it in this order: turn off WP_DEBUG_DISPLAY so visitors never see them, keep them in a private log, update the plugin or theme that the file path names, and report it to the author. Only roll back PHP if a real fatal error appears.

A lot of site owners moved to PHP 8.5 in the last few weeks. The PHP team shipped urgent security releases on 21 October 2026 (8.5.12, 8.4.27, 8.3.36 and 8.2.35), PHP 8.2 leaves security support on 31 December 2026, and many hosts now offer 8.5 as the newest option. Right after the switch, lines that start with Deprecated: show up on the page, in wp-admin or in a fast growing debug.log.

The good news: in almost every case nothing is broken yet. This guide explains what each common PHP 8.5 message means, how to hide it the right way, and how to get the real fix from the plugin or theme author.

Applies to: WordPress 6.9, 7.0 and 7.1 on PHP 8.5 (8.5.12). Messages quoted from WordPress.org support threads for Yoast SEO 28.0 and The Events Calendar. Last verified: November 2026.

01Quick reference

ErrorMost likely causeTry first
Null used as an array keyPlugin code (common in SEO and caching plugins)Update the plugin in the file path
Old SPL method nameEvent, booking or query pluginsUpdate, then check for a real fatal error
Close function no longer neededImage, backup or API pluginsUpdate the plugin
Long cast namesOld custom themesSwap to (bool), (int), (float)

02Why PHP 8.5 shows Deprecated messages

A deprecation is PHP saying: this still works today, but it will be removed in a later major version. PHP 8.5 deprecated a long list of old habits, and many plugins still use them. The official PHP 8.5 deprecation list includes these, which are the ones we meet most in WordPress code:

  • Using null as an array key, or passing null to array_key_exists(). Use an empty string instead.
  • SplObjectStorage::contains(), attach() and detach(). The new names are offsetExists(), offsetSet() and offsetUnset().
  • curl_close(), finfo_close(), imagedestroy() and xml_parser_free(). These no longer do anything because PHP frees the objects on its own.
  • Old cast names such as (boolean), (integer), (double) and (binary). Use (bool), (int), (float) and (string).
  • The backtick operator, a case ending in a semicolon, mysqli_execute() and ReflectionProperty::setAccessible().

WordPress itself supports PHP 8.5 from WordPress 6.9 onward, per the WordPress PHP compatibility table. So if the file path in the message points into wp-content/plugins/ or wp-content/themes/, the plugin or theme is the source, not WordPress core. If you see a Fatal error instead of a Deprecated line, that is a different problem: see TypeError and ArgumentCountError after a PHP upgrade.

Still broken after these steps?

Send us the URL and the exact error. Fixes start from $59, with a fixed quote within 24 hours and an NDA if you need it.

Get a fix quote

03The PHP 8.5 messages people are seeing, and the fix for each

Deprecated: Using null as an array offset is deprecated, use an empty string instead

Quick fix: Hide it from visitors, update the plugin named in the path, report it if there is no update.

Why it happens: Code reads or writes an array with a key that is null, for example $cache[$id] when $id was never set. PHP 8.5 now flags this. One example reported on WordPress.org came from Yoast SEO 28.0 memoizer files on PHP 8.5, and not on 8.4.

  1. Copy the full message, including the file path and line number.
  2. Look at the folder after wp-content/plugins/ or wp-content/themes/. That is the plugin or theme to update.
  3. Update it from Dashboard, Updates. Clear page cache and check whether the message stops.
  4. If no update fixes it, open a topic in that plugin's support forum with the exact message, your PHP version and plugin version.
  5. Keep WP_DEBUG_DISPLAY off while you wait (see the settings section below).

Do not edit the plugin file yourself on a client site. The next plugin update overwrites your change, and a typo there can take the site down.

Deprecated: Method SplObjectStorage::contains() is deprecated since 8.5, use method SplObjectStorage::offsetExists() instead

Quick fix: Not fatal. Update the plugin, and stop the log flood while you wait.

Why it happens: The plugin calls an SPL method that PHP 8.5 renamed. A WordPress.org thread showed this repeated hundreds of times from The Events Calendar's query monitor file. The plugin's support team said the messages are not fatal and recommended PHP 8.4 if the site has trouble.

  1. Check whether the site actually fails. Visit the front end and wp-admin with the log open.
  2. Update the plugin named in the path to the newest version.
  3. If the same line repeats on every request, turn off WP_DEBUG_LOG or filter deprecations (code below) so the log does not fill the disk.
  4. If the site really crashes, look for a line that starts with PHP Fatal error. That line, not the deprecation, is the real cause.
  5. If you cannot find a fatal error and the site still fails, switch PHP back to 8.4 in your host panel and test again.

Deprecated: Function curl_close() (or imagedestroy(), finfo_close()) is deprecated

Quick fix: Harmless leftover cleanup calls. Update the plugin.

Why it happens: Older code closes cURL handles, images or file info objects by hand. Since PHP 8.0 these are objects that PHP frees on its own, so in 8.5 the close functions are deprecated. Image, PDF, backup and API plugins often still call them.

  1. Note which plugin folder the path points to.
  2. Update that plugin. Many authors already removed these calls.
  3. If you maintain the code, wrap the call in a version check or delete it, since it has no effect on PHP 8 and later.
  4. Retest image uploads or the API feature the plugin provides.
if ( PHP_VERSION_ID < 80000 ) {
    curl_close( $ch );
}

Deprecated: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead

Quick fix: A one word code change for the author: (boolean) becomes (bool).

Why it happens: Very old themes and plugins use long cast names such as (boolean), (integer) or (double). PHP 8.5 accepts only the short names without a notice.

  1. Update the theme or plugin named in the path.
  2. If the theme is custom and you own the code, replace (boolean) with (bool), (integer) with (int), (double) with (float) and (binary) with (string).
  3. Make the change in a child theme or in your repository, never on the live server only.
  4. Clear OPcache or restart PHP from the host panel so the new file loads.

04Hide the messages from visitors without losing them

Deprecated lines should never print on a live page. They look broken to visitors, they can break JSON responses (the block editor then shows Updating failed. The response is not a valid JSON response) and they can cause headers already sent warnings. The WordPress debugging docs recommend this setup in wp-config.php, above the line that says "That's all, stop editing!":

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Now messages go to wp-content/debug.log and nobody sees them on screen. When you finish testing, set WP_DEBUG back to false. If your host shows errors even with WP_DEBUG off, set display_errors to Off in the PHP settings of your control panel. PHP's own error configuration docs say display_errors should never be on for production. If the change does not apply, see php.ini changes don't take effect.

05Stop a debug.log flood from filling the disk

One deprecated call inside a loop can write the same line on every request, and a busy site can fill its log fast. That can lead to Disk quota exceeded. If you need the log on for other errors but want to skip deprecations while you wait for plugin updates, add a small must-use plugin. Save it as wp-content/mu-plugins/hide-deprecated.php:

<?php
// Keep logging real errors, skip PHP deprecation notices.
error_reporting( E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED );

Must-use plugins load before normal plugins, so this covers plugin code that runs after it. Delete the file once your plugins are updated, so you see new deprecations before PHP 9 turns them into errors. Then empty the old debug.log or download it and delete it. A public debug.log can expose file paths, so block it or move it outside the web root with a custom path in WP_DEBUG_LOG.

06Should you roll back to PHP 8.4?

Usually no. Deprecations do not break a site on their own. Roll back only when there is a real Fatal error you cannot fix quickly, or a plugin author says their plugin is not ready for 8.5. PHP 8.4 gets active support until 31 December 2026 and security fixes until 31 December 2028, per the PHP supported versions page, so it is a safe place to wait. Do not drop to 8.1 or older: those branches are out of support.

PHP versionStatus todayOur advice
8.5Active support until 31 Dec 2027Use it once your plugins are clean
8.4Active support until 31 Dec 2026Safe fallback while you wait for updates
8.3Security fixes only until 31 Dec 2027Fine, plan a move
8.2Security fixes end 31 Dec 2026Upgrade this quarter
8.1 and olderNo supportUpgrade now

For a fleet of client sites, test on staging first, list every plugin that logs a deprecation, and update in batches. That is part of our white label maintenance plans. If a site is already showing errors, our WordPress error fix service can clean it up under your brand. For the general version of this problem, see Deprecated or Warning messages after a PHP upgrade and PHP version won't change in cPanel.

Need the full list? See our WordPress errors fix guide and the hosting, PHP and cPanel errors guide.

07FAQ

Are PHP 8.5 deprecated warnings dangerous for my WordPress site?

No. They are notices. The code still runs the same way. They become a problem only when they print on the page, break JSON responses or flood the log until the disk fills up.

Why did the warnings start after my host updated PHP?

PHP 8.5 marked many old functions and patterns as deprecated, and many plugins still use them. Hosts moved sites to newer PHP after the October 2026 security releases, so the notices appeared on sites that did not change anything else.

How do I hide deprecated warnings in WordPress?

Set WP_DEBUG_DISPLAY to false in wp-config.php and turn display_errors off in your host's PHP settings. Messages then go to the log only. To skip them in the log too, use a small mu-plugin that removes E_DEPRECATED from error reporting.

Does WordPress support PHP 8.5?

Yes. The WordPress PHP compatibility table lists PHP 8.5 as supported from WordPress 6.9 onward, including 7.0 and 7.1. Plugins and themes are the usual source of the notices.

Should I edit the plugin file to remove the warning?

Not on a live client site. The next update overwrites your edit. Report the exact message to the plugin author, update when a fix ships, and hide the notices in the meantime.

Will these warnings become errors later?

Deprecated features are planned for removal in a later major PHP version. When that happens the same code can throw a fatal error, so it pays to get plugins updated now while it is only a notice.

Md Abu Jubaer Piash

Founder and lead WordPress developer, Finest Web Geek

Piash has built WordPress sites for agencies since 2013. He and his small team have shipped 800+ projects, most of them in Divi and Elementor, all under someone else’s brand.

  • MSc, Computer Science and Engineering
  • Top Rated Plus on Upwork
  • 800+ projects since 2013

How we write: every post comes from our own client work and is checked against the official docs. We update posts when the tools change.

Got a build on your desk right now?

Send the brief today and get a fixed quote by tomorrow.