钩子文档

filesystem_method_file

💡 云策文档标注

概述

filesystem_method_file 是一个 WordPress 过滤器钩子,用于过滤特定文件系统方法类文件的路径。它允许开发者自定义文件系统类文件的加载位置。

关键要点

  • filesystem_method_file 是一个过滤器钩子,用于修改文件系统方法类文件的路径。
  • 它接受两个参数:$path(文件路径字符串)和 $method(文件系统方法字符串)。
  • 该钩子在 WP_Filesystem() 函数中调用,用于初始化 WordPress 文件系统抽象类。
  • 自 WordPress 2.6.0 版本引入。

代码示例

$abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );

📄 原文内容

Filters the path for a specific filesystem method class file.

Description

See also

Parameters

$pathstring
Path to the specific filesystem method class file.
$methodstring
The filesystem method to use.

Source

$abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );

Changelog

Version Description
2.6.0 Introduced.