Show a confirm message before plug-in activation

You can read more about the details of activation on this answer.

Basically you need to hook a function to register_activation_hook() – assuming, that this is from within your main plugin folder and not a subfolder:

register_activation_hook( __FILE__, 'on_activation' );
function wpse65190_on_activation()
{
   // Add an admin notice:
   add_action( 'admin_notices', 'wpse65190_on_activation_note' );

   // Then you should check the DB option: 
   $plugins = get_option( 'active_plugins' );

   if ( ! in_array( dirname( __FILE__ ), $plugins )
   {
       unset( $plugins[ dirname( __FILE__ ) ] );
       update_option( 'active_plugins', $plugins );
   }
}
function wpse65190_on_activation_note()
{
    // Add your note here: Maybe a form?
}

It’s as easy as that. You just have to fill in the gaps. If you got a full working example, please update this answer with your working code. Thanks.

Leave a Comment