钩子文档

is_protected_endpoint

💡 云策文档标注

概述

is_protected_endpoint 是一个 WordPress 过滤器,用于判断当前请求是否针对受保护的端点。它仅在请求的端点未被 WordPress 核心保护时触发,允许开发者添加额外的受保护端点。

关键要点

  • 过滤器名称:is_protected_endpoint
  • 触发条件:当请求的端点未被 WordPress 核心(如管理后台、登录页面、受保护的 Ajax 操作)保护时
  • 参数:$is_protected_endpoint(布尔值),默认 false,表示当前请求的端点是否受保护
  • 返回值:通过 apply_filters 返回布尔值,用于确定端点保护状态
  • 相关函数:is_protected_endpoint(),位于 wp-includes/load.php,用于判断当前是否在应防止 WSOD(白屏死机)的端点上
  • 引入版本:WordPress 5.2.0

📄 原文内容

Filters whether the current request is against a protected endpoint.

Description

This filter is only fired when an endpoint is requested which is not already protected by WordPress core. As such, it exclusively allows providing further protected endpoints in addition to the admin backend, login pages and protected Ajax actions.

Parameters

$is_protected_endpointbool
Whether the currently requested endpoint is protected.
Default false.

Source

return (bool) apply_filters( 'is_protected_endpoint', false );

Changelog

Version Description
5.2.0 Introduced.