do_action( 'admin_init' )

Fires as an admin screen or script is being initialized.


Description Description

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.


Source Source

File: wp-admin/admin.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Rnaby
    
    /**
     * Fire on the initialization of the admin screen or scripts.
     */
    function the_dramatist_fire_on_admin_screen_initialization() {
        // Do stuff. Say we will echo "Hello World".
        echo 'Hello World';
    }
    add_action( 'admin_init', 'the_dramatist_fire_on_admin_screen_initialization' );
    

    The above piece of code will only echo “Hello World” if the user is in admin screen.

You must log in before being able to contribute a note or feedback.