钩子文档

fs_ftp_connection_types

💡 云策文档标注

概述

fs_ftp_connection_types 是一个 WordPress 过滤器,用于自定义在文件系统凭据表单中显示的连接类型。它允许开发者根据上下文调整可用的连接选项。

关键要点

  • 过滤器名称:fs_ftp_connection_types
  • 主要用途:过滤文件系统凭据表单中的连接类型数组
  • 参数:包括 $types(连接类型数组)、$credentials(凭据数组)、$type(选择的文件系统方法)、$error(错误状态或对象)、$context(目录路径)
  • 相关函数:与 request_filesystem_credentials() 配合使用,用于处理 FTP/SSH 连接
  • 版本历史:从 WordPress 2.9.0 引入,4.6.0 版本中 $context 参数默认值从 false 改为空字符串

📄 原文内容

Filters the connection types to output to the filesystem credentials form.

Parameters

$typesstring[]
Types of connections.
$credentialsarray
Credentials to connect with.
$typestring
Chosen filesystem method.
$errorbool|WP_Error
Whether the current request has failed to connect, or an error object.
$contextstring
Full path to the directory that is tested for being writable.

Source

$types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );

Changelog

Version Description
4.6.0 The $context parameter default changed from false to an empty string.
2.9.0 Introduced.