Make WordPress Core

Opened 7 months ago

Last modified 7 months ago

#59362 new enhancement

Display deprecated function usage in Site Health

Reported by: michi91's profile Michi91 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.3.1
Component: Site Health Keywords: 2nd-opinion dev-feedback
Focuses: administration Cc:

Description

Enhancement Request

Summary

WordPress Site Health provides valuable information about the health and performance of a WordPress instance. However, it does not offer any insights into whether the instance is using deprecated functions, classes, constructors, hooks, file_includes, which can be crucial for maintaining the site's compatibility with future WordPress versions.

This enhancement ticket proposes adding an additional check to Site Health that detects and displays information about any deprecated functions, classes, constructors, hooks, file_includes, being used within the WordPress instance.

Adding a "Deprecated Functions" check to the Site Health tool will be a enhancement for WordPress administrators, helping them identify and replace deprecated functions, classes, constructors, hooks, file_includes, plugins, themes, ensuring the site's long-term stability and compatibility with upcoming WordPress updates.

Details

The deprecated function check should be integrated into the existing Site Health tool as follows:

  1. Log: Log deprecated functions, classes, constructors, hooks, file_includes
  1. Display Check Results: Under a "Deprecated Functions" check, display a list of deprecated functions, classes, constructors, hooks and file_includes used in the WordPress instance. Result should
    • include the function, class, constructor, hook or file_include name
    • the version in which it was deprecated
    • which Plugin or Theme called it,
    • when in was called the last time
    • a brief explanation of the recommended action.

Implementation Suggestions

  • Utilize existing WordPress core functionality for detecting usage of deprecated functions
  • Add a action to 'deprecated_{[]}_run' that logs the usage of a deprecated functions
  • Use debug_backtrace() do indentify the source / code.
  • The check results should display the log entries with status 'recommended'.
  • Keep the log process "stupid" and put logic etc. into the check, to avoid complexity and potential crashes.

Challenges

  • To provide the administrator with sufficient information so that they are capable of taking action.
  • Decision on how long entries stay in the log e.g. only show deprecated function calls of the last 30 days or allow the (administrative ) user to clear the log?
  • Should there be one check in Site Health of all kinds of deprecated? Or one for each?

Why It's Important

WordPress is constantly evolving, and maintaining compatibility with newer versions is crucial for security and performance reasons. Deprecated functions may be removed in future releases, causing issues for sites that rely on them. By providing this information in Site Health, WordPress can empower site administrators to keep their installations future proof.

Change History (1)

Note: See TracTickets for help on using tickets.