Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: activate_plugin

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
476      $valid = validate_plugin($plugin);
477      if ( is_wp_error($valid) )
478           return $valid;
479
480      if ( !in_array($plugin, $current) ) {
481           if ( !empty($redirect) )
482                wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
483           ob_start();
484           include(WP_PLUGIN_DIR . '/' . $plugin);
485           do_action( 'activate_plugin', trim( $plugin) );
486           if ( $network_wide ) {
487                $current[$plugin] = time();
488                update_site_option( 'active_sitewide_plugins', $current );
489           } else {
490                $current[] = $plugin;
491                sort($current);
492                update_option('active_plugins', $current);
493           }
494           do_action( 'activate_' . trim( $plugin ) );