Website Without PHP
US
Menu

Deprecation

Also known as: deprecated, deprecation notice

A deprecation is an early warning that a feature still works today but will be removed in a future PHP version, so code using it must be changed in time.

PHP and versions Last updated:

A deprecation is an early warning that a feature still works today but will be removed in a future PHP version, so code using it must be changed in time. It does not break your site today, but it tells you what may break after the next upgrade.

What is a deprecation?

PHPPHP is a programming language that builds your web pages on the computer that hosts your site, just before they reach the visitor. WordPress runs on it. shows it as a notice of the type E_DEPRECATED. It tells you what may break on the next PHP versionA PHP version is a numbered edition of PHP, like 8.3. Each edition is looked after for a limited time, then gets security fixes only, then nothing..

PHP evolves, and sometimes a function, a setting or a way of writing code is replaced by something better or safer. The PHP project does not remove the old way in one step. It first marks it as deprecated in a release, which gives developers time to switch, and removes it in a later release.

The notice says which feature is deprecated, in which file and on which line. A typical example from PHP 8.2 is creating a property on an object that was not declared in its class, so-called dynamic properties. Older plugins that do this still run on 8.2, but they trigger a notice and are likely to need changes later.

Deprecated, removed and fatal

These are three different stages. A deprecation is a warning. A removal means the feature is gone in a later version. A fatal error is what a site shows when code still calls something that was removed. The purpose of deprecation notices is to avoid the last stage.

Deprecations on your WordPress site

On a WordPressWordPress is free software for building and editing a website in your browser. It is written in PHP, so it builds each page when someone visits. site, deprecation notices almost always come from a theme or pluginA WordPress plugin is an add-on you install in WordPress to give your site extra features, such as contact forms, SEO tools or a webshop. that was written for older PHP versions. Sometimes they show on screen, which looks alarming. On a live site that should not happen, because the production setting is to keep errors out of sight and write them to the error logAn error log is a file where your website's software writes down what went wrong, with the time and place. It is the first thing to check when a site breaks..

The bigger risk is the update. Moving from one PHP branch to another turns yesterday’s notices into today’s fatal errors if the code was not changed in the meantime. This is a frequent cause of a white screen after an upgrade.

How to find deprecations before an update

Copy the site to a staging environmentA staging environment is a private copy of your website where you try updates first, so any mistakes happen there and not on the live site., switch that copy to the target PHP version and turn on logging. In WordPress, setting WP_DEBUGWP_DEBUG is a WordPress setting that makes hidden errors visible or saves them to a file, which helps find out why a site shows a blank page. and WP_DEBUG_LOG writes messages to a debug.log file in wp-content. Click through the main pages, the checkout and the admin, then read the log.

Group the notices by plugin or theme. A plugin with many notices and no recent update is a warning sign. Check ComposerComposer is a tool that downloads the code libraries a PHP project needs and notes exactly which versions, so the project can be rebuilt the same way anywhere. packages in custom builds too, as libraries have deprecations of their own.

When to act

Act before every PHP update, and when a plugin has not been updated in a long time. Fix what you can, replace what you cannot, and then update. Our PHP upgrade service does this check on a staging copy first. If the code is too old to repair, a PHP migration service moves the site to a setup that fits a modern PHP.

Frequently asked questions

Is a deprecated notice an error?

No. The code still works. The notice is an early warning that the feature will be removed or changed in a later PHP version, so the code needs to be updated.

Why do I see deprecated messages on my WordPress site?

A theme, plugin or custom code uses a PHP feature that has been marked for removal. The message names the file and line, which points to the responsible plugin or theme.

Should I hide deprecation notices?

Hide them from visitors, yes, by keeping errors off the screen on a live site. Do not ignore them completely, because they show what will break on the next PHP version.

Does a deprecation mean I must update PHP?

No, it means you need to fix the code before you update. A site that has no deprecation notices on its current PHP version has a much easier road to the next one.

Related pages

  1. Domain
  2. Check
  3. Result
  4. Report

Which PHP version does your site run?

Enter your domain. We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login. We keep the domain and the result, never your IP address.