Welcome, visitor! Log in
 

Source View: deactivate_{$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

This hook occurs 2 times in this file.

Line Code
28                wp_die(__('Invalid plugin.'));
29           if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
30                wp_die(__('Plugin file does not exist.'));
31           include(ABSPATH . PLUGINDIR . '/' . $plugin);
32      } elseif ('deactivate' == $_GET['action']) {
33           check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
34           $current = get_option('active_plugins');
35           array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
36           update_option('active_plugins', $current);
37           do_action('deactivate_' . trim( $_GET['plugin'] ));
38           wp_redirect('plugins.php?deactivate=true');
39      } elseif ($_GET['action'] == 'deactivate-all') {
40           check_admin_referer('deactivate-all');
41           $current = get_option('active_plugins');
42
43           foreach ($current as $plugin) {
44                array_splice($current, array_search($plugin, $current), 1);
45                do_action('deactivate_' . $plugin);
46           }
47
48           update_option('active_plugins', array());
49           wp_redirect('plugins.php?deactivate-all=true');
50      }
51      exit;
52 }
53
54 $title = __('Manage Plugins');