钩子文档

rest_pre_insert_application_password

💡 云策文档标注

概述

rest_pre_insert_application_password 是一个 WordPress REST API 钩子,用于在通过 REST API 插入应用密码前进行过滤。它允许开发者在密码插入数据库前修改或验证数据。

关键要点

  • 这是一个过滤器钩子,在应用密码通过 REST API 插入前被调用。
  • 接收两个参数:$prepared(表示准备插入数据库的应用密码对象)和 $request(WP_REST_Request 对象)。
  • 钩子定义在 WP_REST_Application_Passwords_Controller::prepare_item_for_database() 方法中,用于准备创建或更新操作的应用密码。
  • 自 WordPress 5.6.0 版本引入。

📄 原文内容

Filters an application password before it is inserted via the REST API.

Parameters

$preparedstdClass
An object representing a single application password prepared for inserting or updating the database.
$requestWP_REST_Request
Request object.

Source

return apply_filters( 'rest_pre_insert_application_password', $prepared, $request );

Changelog

Version Description
5.6.0 Introduced.