D
D
denism3002020-06-02 19:46:05
WordPress
denism300, 2020-06-02 19:46:05

How to check before plugin activation?

I am writing a small plugin that will be an addition to a third-party plugin.
I can’t find anywhere how to perform such a check before activating the plugin:

if( is_plugin_active( 'сторонний плагин' ) ) {
    активируем плагин;
} else {
    add_action( 'admin_notices', 'my_plugin_error_notice' );
    function my_plugin_error_notice( ) {
        $message = 'Плагин такой-то должен быть установлен и активен';
        echo '<div class="notice notice-error is-dismissible"><p>' . $message . '</p></div>';
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Sedov, 2020-06-02
@ivansedov

So, what exactly is the question? You wrote the check correctly, documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question