Welcome, visitor! Log in
 

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
71                 update_option('recently_activated', $recent);
72  
73                 wp_redirect("plugins.php?activate-multi=true&plugin_status=$status&paged=$page");
74                 exit;
75                 break;
76            case 'error_scrape':
77                 check_admin_referer('plugin-activation-error_' . $plugin);
78  
79                 $valid = validate_plugin($plugin);
80                 if ( is_wp_error($valid) )
81                      wp_die($valid);
82  
83                 error_reporting( E_ALL ^ E_NOTICE );
84                 @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
85                 include(WP_PLUGIN_DIR . '/' . $plugin);
86                 do_action('activate_' . $plugin);
87                 exit;
88                 break;
89            case 'deactivate':
90                 check_admin_referer('deactivate-plugin_' . $plugin);
91                 deactivate_plugins($plugin);
92                 update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
93                 wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page");
94                 exit;
95                 break;
96            case 'deactivate-selected':
97                 check_admin_referer('bulk-manage-plugins');
98  
99                 $plugins = (array) $_POST['checked'];
100                 $plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated.
101                 if ( empty($plugins) ) {