钩子文档

deprecated_class_run

💡 云策文档标注

概述

deprecated_class_run 是一个 WordPress Hook,在调用已弃用的类时触发。它用于通知开发者类已被弃用,并提供替代方案和弃用版本信息。

关键要点

  • 触发时机:当实例化一个已弃用的类时触发此 Hook。
  • 参数:$class_name(被实例化的类名)、$replacement(应调用的替代类或函数)、$version(WordPress 弃用该类的版本)。
  • 相关函数:_deprecated_class() 用于标记类为弃用并通知使用情况。
  • 引入版本:WordPress 6.4.0。

📄 原文内容

Fires when a deprecated class is called.

Parameters

$class_namestring
The name of the class being instantiated.
$replacementstring
The class or function that should have been called.
$versionstring
The version of WordPress that deprecated the class.

Source

do_action( 'deprecated_class_run', $class_name, $replacement, $version );

Changelog

Version Description
6.4.0 Introduced.