admin_init хук-событиеWP 2.5.0

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 init hook, which fires earlier.

Использование

add_action( 'admin_init', 'wp_kama_admin_init_action' );

/**
 * Function for `admin_init` action-hook.
 * 
 * @return void
 */
function wp_kama_admin_init_action(){

	// action...
}

Список изменений

С версии 2.5.0 Введена.

Где вызывается хук

В файле: /wp-admin/admin.php
admin_init
wp-admin/admin.php 175
do_action( 'admin_init' );
wp-admin/admin-post.php 30
do_action( 'admin_init' );
wp-admin/admin-ajax.php 45
do_action( 'admin_init' );

Где используется хук в WordPress

wp-admin/includes/admin-filters.php 120
add_action( 'admin_init', 'default_password_nag_handler' );
wp-admin/includes/admin-filters.php 164
add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_content' ), 1 );
wp-admin/includes/admin-filters.php 41
add_action( 'admin_init', 'register_admin_color_schemes', 1 );
wp-admin/includes/admin-filters.php 46
add_action( 'admin_init', 'wp_admin_headers' );
wp-admin/includes/admin-filters.php 48
add_action( 'admin_init', 'send_frame_options_header', 10, 0 );
wp-admin/includes/admin-filters.php 158
add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'text_change_check' ), 100 );
wp-includes/blocks/legacy-widget.php 149
add_action( 'admin_init', 'handle_legacy_widget_preview_iframe', 20 );
wp-includes/class-wp-customize-manager.php 374
remove_action( 'admin_init', '_maybe_update_core' );
wp-includes/class-wp-customize-manager.php 375
remove_action( 'admin_init', '_maybe_update_plugins' );
wp-includes/class-wp-customize-manager.php 376
remove_action( 'admin_init', '_maybe_update_themes' );
wp-includes/default-filters.php 629
add_action( 'admin_init', '_wp_admin_bar_init' );
wp-includes/default-filters.php 107
add_action( 'admin_init', 'wp_schedule_update_user_counts' );
wp-includes/default-filters.php 493
add_action( 'admin_init', '_wp_check_for_scheduled_update_comment_type' );
wp-includes/default-filters.php 486
add_action( 'admin_init', '_wp_check_for_scheduled_split_terms' );
wp-includes/ms-default-filters.php 84
add_action( 'admin_init', 'wp_schedule_update_network_counts' );
wp-includes/ms-default-filters.php 91
remove_action( 'admin_init', 'wp_schedule_update_user_counts' );
wp-includes/script-loader.php 3657
add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles );
wp-includes/update.php 1084
add_action( 'admin_init', '_maybe_update_core' );
wp-includes/update.php 1090
add_action( 'admin_init', '_maybe_update_plugins' );
wp-includes/update.php 1096
add_action( 'admin_init', '_maybe_update_themes' );