Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: dynamic_sidebar_before

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

This hook occurs 2 times in this file.

Line Code
678                     $index = $key;
679                     break;
680                }
681           }
682      }
683
684      $sidebars_widgets = wp_get_sidebars_widgets();
685      if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) {
686           /** This action is documented in wp-includes/widget.php */
687           do_action( 'dynamic_sidebar_before', $index, false );
688           /** This action is documented in wp-includes/widget.php */
689           do_action( 'dynamic_sidebar_after', $index, false );
690           /** This filter is documented in wp-includes/widget.php */
691           return apply_filters( 'dynamic_sidebar_has_widgets', false, $index );
692      }
693
694      /**
695       * Fires before widgets are rendered in a dynamic sidebar.
696       *
697       * Note: The action also fires for empty sidebars, and on both the front end
698       * and back end, including the Inactive Widgets sidebar on the Widgets screen.
699       *
700       * @since 3.9.0
701       *
702       * @param int|string $index       Index, name, or ID of the dynamic sidebar.
703       * @param bool       $has_widgets Whether the sidebar is populated with widgets.
704       *                                Default true.
705       */
706      do_action( 'dynamic_sidebar_before', $index, true );
707      $sidebar = $wp_registered_sidebars[ $index ];
708
709      $did_one = false;
710      foreach ( (array) $sidebars_widgets[ $index ] as $id ) {
711
712           if ( ! isset( $wp_registered_widgets[ $id ] ) ) {
713                continue;
714           }
715