钩子文档

deprecated_file_included

💡 云策文档标注

概述

当 WordPress 调用已弃用的文件时,会触发 deprecated_file_included 钩子。此钩子用于通知开发者文件已被弃用,并提供相关信息。

关键要点

  • 触发时机:当 WordPress 调用一个已弃用的文件时触发此钩子。
  • 参数说明:$file(被调用的文件)、$replacement(基于 ABSPATH 应包含的替代文件)、$version(弃用该文件的 WordPress 版本)、$message(关于变更的消息)。
  • 相关函数:_deprecated_file() 用于标记文件为弃用并通知使用情况。
  • 版本历史:自 WordPress 2.5.0 版本引入。

📄 原文内容

Fires when a deprecated file is called.

Parameters

$filestring
The file that was called.
$replacementstring
The file that should have been included based on ABSPATH.
$versionstring
The version of WordPress that deprecated the file.
$messagestring
A message regarding the change.

Source

do_action( 'deprecated_file_included', $file, $replacement, $version, $message );

Changelog

Version Description
2.5.0 Introduced.