WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )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.
| Line | Code |
|---|---|
| 12 | /** WordPress Administration Widgets API */ |
| 13 | require_once(ABSPATH . 'wp-admin/includes/widgets.php'); |
| 14 | |
| 15 | if ( ! current_user_can('switch_themes') ) |
| 16 | wp_die( __( 'Cheatin’ uh?' )); |
| 17 | |
| 18 | wp_enqueue_script( array( 'wp-lists', 'admin-widgets' ) ); |
| 19 | wp_admin_css( 'widgets' ); |
| 20 | |
| 21 | do_action( 'sidebar_admin_setup' ); |
| 22 | |
| 23 | $title = __( 'Widgets' ); |
| 24 | $parent_file = 'themes.php'; |
| 25 | |
| 26 | // $sidebar = What sidebar are we editing? |
| 27 | if ( isset($_GET['sidebar']) && isset($wp_registered_sidebars[$_GET['sidebar']]) ) { |
| 28 | $sidebar = attribute_escape( $_GET['sidebar'] ); |
| 29 | } elseif ( is_array($wp_registered_sidebars) && !empty($wp_registered_sidebars) ) { |
| 30 | // By default we look at the first defined sidebar |