admin_init
Action HookDescription
Fires as an admin screen or script is being initialized. Note, this does not just run on user-facing admin screens. It runs on admin-ajax.php and admin-post.php as well. This is roughly analogous to the more general {@see 'init'} hook, which fires earlier.Hook Information
File Location |
wp-admin/admin.php
View on GitHub
|
Hook Type | Action |
Line Number | 176 |
Hook Parameters
This hook doesn't accept any parameters.
Usage Examples
Basic Usage
<?php
// Hook into admin_init
add_action('admin_init', 'my_custom_function');
function my_custom_function() {
// Your custom code here
}
Source Code Context
wp-admin/admin.php:176
- How this hook is used in WordPress core
<?php
171 *
172 * This is roughly analogous to the more general {@see 'init'} hook, which fires earlier.
173 *
174 * @since 2.5.0
175 */
176 do_action( 'admin_init' );
177
178 if ( isset( $plugin_page ) ) {
179 if ( ! empty( $typenow ) ) {
180 $the_parent = $pagenow . '?post_type=' . $typenow;
181 } else {
PHP Documentation
<?php
/**
* Fires as an admin screen or script is being initialized.
*
* Note, this does not just run on user-facing admin screens.
* It runs on admin-ajax.php and admin-post.php as well.
*
* This is roughly analogous to the more general {@see 'init'} hook, which fires earlier.
*
* @since 2.5.0
*/
Quick Info
- Hook Type: Action
- Parameters: 0
- File: wp-admin/admin.php
Related Hooks
Related hooks will be displayed here in future updates.