钩子文档

welcome_panel

💡 云策文档标注

概述

welcome_panel 是一个 WordPress 动作钩子,在管理仪表盘欢迎面板添加内容时触发。开发者可以利用此钩子自定义或移除默认欢迎面板。

关键要点

  • welcome_panel 钩子在管理仪表盘欢迎面板添加内容时触发,用于自定义面板内容。
  • 要移除默认欢迎面板,可以使用 remove_action('welcome_panel', 'wp_welcome_panel') 函数。
  • 此钩子自 WordPress 3.5.0 版本引入,源代码为 do_action('welcome_panel')。

代码示例

remove_action( 'welcome_panel', 'wp_welcome_panel' );

注意事项

使用 remove_action 移除默认面板时,需确保在适当的时机(如插件或主题初始化时)调用,以避免冲突或无效操作。


📄 原文内容

Fires when adding content to the welcome panel on the admin dashboard.

Description

To remove the default welcome panel, use remove_action() :

remove_action( 'welcome_panel', 'wp_welcome_panel' );

Source

do_action( 'welcome_panel' );

Changelog

Version Description
3.5.0 Introduced.