activate_plugin

activate_plugin

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7

do_action('activate_plugin') is found 2 times:

  • /wp-admin/includes/plugin.php line 703
    			 *
    			 * @param bool $network_wide Whether to enable the plugin for all sites in the network
    			 *                           or just the current site. Multisite only. Default false.
    			 */
    			do_action( "activate_{$plugin}", $network_wide );
    		}
    
    		if ( $network_wide ) {
    			$current            = get_site_option( 'active_sitewide_plugins', array() );
    			$current[ $plugin ] = time();
    			update_site_option( 'active_sitewide_plugins', $current );
    
  • /wp-admin/plugins.php line 196
    			ini_set( 'display_errors', true ); // Ensure that fatal errors are displayed.
    			// Go back to "sandbox" scope so we get the same errors as before.
    			plugin_sandbox_scrape( $plugin );
    			/** This action is documented in wp-admin/includes/plugin.php */
    			do_action( "activate_{$plugin}" );
    			exit;
    
    		case 'deactivate':
    			if ( ! current_user_can( 'deactivate_plugin', $plugin ) ) {
    				wp_die( __( 'Sorry, you are not allowed to deactivate this plugin.' ) );
    			}
    

See this hook used in plugins: