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
643                     $index = $key;
644                     break;
645                }
646           }
647      }
648
649      $sidebars_widgets = wp_get_sidebars_widgets();
650      if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) {
651           /** This action is documented in wp-includes/widget.php */
652           do_action( 'dynamic_sidebar_before', $index, false );
653           /** This action is documented in wp-includes/widget.php */
654           do_action( 'dynamic_sidebar_after', $index, false );
655           /** This filter is documented in wp-includes/widget.php */
656           return apply_filters( 'dynamic_sidebar_has_widgets', false, $index );
657      }
658
659      /**
660       * Fires before widgets are rendered in a dynamic sidebar.
661       *
662       * Note: The action also fires for empty sidebars, and on both the front end
663       * and back end, including the Inactive Widgets sidebar on the Widgets screen.
664       *
665       * @since 3.9.0
666       *
667       * @param int|string $index       Index, name, or ID of the dynamic sidebar.
668       * @param bool       $has_widgets Whether the sidebar is populated with widgets.
669       *                                Default true.
670       */
671      do_action( 'dynamic_sidebar_before', $index, true );
672      $sidebar = $wp_registered_sidebars[ $index ];
673
674      $did_one = false;
675      foreach ( (array) $sidebars_widgets[ $index ] as $id ) {
676
677           if ( ! isset( $wp_registered_widgets[ $id ] ) ) {
678                continue;
679           }
680