Skip to content

Instantly share code, notes, and snippets.

@sheabunge
Created May 18, 2013 04:41
Show Gist options
  • Save sheabunge/5603268 to your computer and use it in GitHub Desktop.
Save sheabunge/5603268 to your computer and use it in GitHub Desktop.
Adds the option to activate a plugin only on the main site to the network admin plugin install screen
<?php
/*
* Plugin Name: Activate Plugin After Install
* Description: Adds the option to activate a plugin only on the main site to the network admin plugin install screen
* Plugin URI:
* Version: 2013.05.18
* Author: Shea Bunge
* Author URI: http://bungeshea.com
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
*/
function activate_plugin_after_install( $install_actions, $api, $plugin_file ) {
return array_merge( array( 'activate_plugin' => sprintf (
'<a href="%1$s" title="%2$s" target="_parent">%3$s</a>',
wp_nonce_url( admin_url('plugins.php?action=activate&plugin=' . $plugin_file), 'activate-plugin_' . $plugin_file ),
esc_attr__('Activate this plugin'),
__('Activate Plugin')
) ), $install_actions );
}
add_filter( 'install_plugin_complete_actions', 'activate_plugin_after_install', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment