wp_admin_notice
Action HookDescription
Fires before an admin notice is output.Hook Information
File Location |
wp-includes/functions.php
View on GitHub
|
Hook Type | Action |
Line Number | 9094 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$message
|
The message for the admin notice. |
array
|
$args
|
The arguments for the admin notice. |
Usage Examples
Basic Usage
<?php
// Hook into wp_admin_notice
add_action('wp_admin_notice', 'my_custom_function', 10, 2);
function my_custom_function($message, $args) {
// Your custom code here
}
Source Code Context
wp-includes/functions.php:9094
- How this hook is used in WordPress core
<?php
9089 * @since 6.4.0
9090 *
9091 * @param string $message The message for the admin notice.
9092 * @param array $args The arguments for the admin notice.
9093 */
9094 do_action( 'wp_admin_notice', $message, $args );
9095
9096 echo wp_kses_post( wp_get_admin_notice( $message, $args ) );
9097 }
9098
9099 /**
PHP Documentation
<?php
/**
* Fires before an admin notice is output.
*
* @since 6.4.0
*
* @param string $message The message for the admin notice.
* @param array $args The arguments for the admin notice.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/functions.php
Related Hooks
Related hooks will be displayed here in future updates.