钩子文档

user_new_form

💡 云策文档标注

概述

user_new_form 是一个 WordPress 钩子,在新用户表单末尾触发,用于区分多站点和单站点环境下的表单类型。

关键要点

  • 触发时机:在新用户表单的末尾执行。
  • 参数:接受一个字符串参数 $type,指定表单类型上下文,如 'add-existing-user'(多站点)或 'add-new-user'(单站点和网络管理员)。
  • 版本历史:自 WordPress 3.7.0 引入。
  • 相关钩子:对于网络站点,自 4.5 版本起,可使用 network_user_new_form 钩子。

📄 原文内容

Fires at the end of the new user form.

Description

Passes a contextual string to make both types of new user forms uniquely targetable. Contexts are ‘add-existing-user’ (Multisite), and ‘add-new-user’ (single site and network admin).

Parameters

$typestring
A contextual string specifying which type of new user form the hook follows.

Source

do_action( 'user_new_form', 'add-existing-user' );

Changelog

Version Description
3.7.0 Introduced.

User Contributed Notes