Action

Glossary Index

Actions most closely resemble event triggers in other programming languages.

Actions have defined names such as “init” or “plugins_loaded”, etc.  As a WordPress developer, you can write a code routine to be executed during the “init” sequence while WordPress is loading.

As an example, if you wanted to initialize certain variables during the init sequence you would use a code block such as the following:

// A custom init routine
function my_custom_init(){
    // Do initialization tasks for your plugin
}

// Register the action
add_action('init', 'my_custom_init', 1);
Posted in and tagged , .