plugin_loaded

最后更新于:2021-11-27 14:41:17

do_action( ‘plugin_loaded’, string $plugin )

Fires once a single activated plugin has loaded.

参数

$plugin

(string)
Full path to the plugin’s main file.

源文件

文件: gc-settings.php

View on Trac

add_action( 'plugin_loaded', array( 'gcdocs_class_name', 'instance' ) );

class gcdocs_class_name {
     
    private function __construct() {
        self::init();
    }
     
    public static function instance() {
        static $instance = null;

        if ( is_null( $instance ) ) {
                $instance = new gcdocs_class_name;
        }

        return $instance
    }
     
    public function init() {
        gc_die( __( 'Hello World!', 'text-domain' ) );
    }
     
}