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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
54                break;
55           case 'error_scrape':
56                check_admin_referer('plugin-activation-error_' . $plugin);
57                $valid = validate_plugin($plugin);
58                if ( is_wp_error($valid) )
59                     wp_die($valid);
60                error_reporting( E_ALL ^ E_NOTICE );
61                @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
62                include(WP_PLUGIN_DIR . '/' . $plugin);
63                do_action('activate_' . $plugin);
64                exit;
65                break;
66           case 'deactivate':
67                check_admin_referer('deactivate-plugin_' . $plugin);
68                deactivate_plugins($plugin);
69                update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
70                wp_redirect('plugins.php?deactivate=true');
71                exit;
72                break;