类静态方法回调

class MyClass {
    static function my_init_method() {
        // do something here
    }
}

add_action( 'init', array( 'MyClass', 'my_init_method' ) );

使用类的静态方法来挂钩一组指令。使用 init 钩子,在 wordpress 完成加载必要组件后立即执行指令集。