钩子文档

pre_wp_get_https_detection_errors

💡 云策文档标注

概述

pre_wp_get_https_detection_errors 是一个 WordPress 过滤器,用于在检测 HTTPS 支持错误时短路默认逻辑。开发者可以通过此过滤器返回 WP_Error 对象来跳过远程 HTTPS 请求,直接存储错误信息。

关键要点

  • 这是一个过滤器,允许开发者干预 HTTPS 错误检测过程。
  • 返回 WP_Error 对象可以短路默认的远程 HTTPS 请求逻辑。
  • 参数 $pre 可以是 null 或 WP_Error 对象,null 表示继续默认行为。
  • 与 wp_get_https_detection_errors() 函数相关,用于检测 HTTPS 支持。
  • 在 WordPress 6.4.0 版本中引入。

代码示例

$support_errors = apply_filters( 'pre_wp_get_https_detection_errors', null );

📄 原文内容

Short-circuits the process of detecting errors related to HTTPS support.

Description

Returning a WP_Error from the filter will effectively short-circuit the default logic of trying a remote request to the site over HTTPS, storing the errors array from the returned WP_Error instead.

Parameters

$prenull|WP_Error
Error object to short-circuit detection, or null to continue with the default behavior.

Source

$support_errors = apply_filters( 'pre_wp_get_https_detection_errors', null );

Changelog

Version Description
6.4.0 Introduced.