WordPress required install plugin when activate plugin

I want when i active plugin A, if plugin B not installed, i will required install plugin B.

Look like required plugin when install theme.

Read More

How i can do that? Somebody can help me?

Related posts

Leave a Reply

1 comment

  1. You will put this code in Plugin A :

    register_activation_hook( __FILE__, 'A_on_activation' );
    
    function A_on_activation(){
        if ( ! is_plugin_active( 'plugin-directory/B-plugin-file.php' ) ) {
            //Do what you want 
        } 
    }