class MyClass {
static function my_init_method() {
// do something here
}
}
add_action( 'init', array( 'MyClass', 'my_init_method' ) );
Using a static method of a class to hook a set of instructions. With the init
hook, the set of instructions will be executed right after wordpress has finished loading the necessary components.