Execute Hook on the footer or header after activating a plugin

Checking the action hooks API reference, “activated_plugin” is an Advanced hook. It operates outside the normal loop which would permit you to do what you want.

A better way would be to add_action('admin_footer_text'), as illustrated in this WPBeginner article.

However, if you only want this to show when a particular plugin is activated, you can add the following “if” statement to check if your plugin is active:

if (is_plugin_active($plugin_path)){
    add_filter('admin_footer_text', '[your function here]');
}

If you only want this to run once, immediately after the plugin is activated, you might use your “activated_plugin” to set an option variable. Then, use your “admin_footer_text” action to check for and clear that option variable:

// Set the option indicating the plugin was just activated
function wpse_set_activated(){
    add_option("wpse_my_plugin_activated",'true');
}
add_action("activated_plugin","wpse_set_activated");

// Setup conditional admin_footer text mod
function wpse_setup_admin_footer_text(){
    if (is_plugin_active("plugin_folder/my_plugin.php")){
        $just_activated = get_option("wpse_my_plugin_activated",'false');
        if ($just_activated !== 'true') {
            echo "";
        } else {
            echo "My plugin is active";
            delete_option("wpse_my_plugin_activated");
        } // end if is_active
    } else {
        echo "";
    }// end if is_plugin_active
}
add_filter('admin_footer_text', 'wpse_set_admin_footer_text');

Hope this helps!

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş