Action hook 'dynamic_sidebar_after'

in WP Core File wp-includes/widgets.php at line 866

View Source

dynamic_sidebar_after

Action Hook
Description
Fires after widgets are rendered in a dynamic sidebar. Note: The action also fires for empty sidebars, and on both the front end and back end, including the Inactive Widgets sidebar on the Widgets screen.

Hook Information

File Location wp-includes/widgets.php View on GitHub
Hook Type Action
Line Number 866

Hook Parameters

Type Name Description
int|string $index Index, name, or ID of the dynamic sidebar.
bool $has_widgets Whether the sidebar is populated with widgets. Default true.

Usage Examples

Basic Usage
<?php
// Hook into dynamic_sidebar_after
add_action('dynamic_sidebar_after', 'my_custom_function', 10, 2);

function my_custom_function($index, $has_widgets) {
    // Your custom code here
}

Source Code Context

wp-includes/widgets.php:866 - How this hook is used in WordPress core
<?php
 861  	 *
 862  	 * @param int|string $index       Index, name, or ID of the dynamic sidebar.
 863  	 * @param bool       $has_widgets Whether the sidebar is populated with widgets.
 864  	 *                                Default true.
 865  	 */
 866  	do_action( 'dynamic_sidebar_after', $index, true );
 867  
 868  	/**
 869  	 * Filters whether a sidebar has widgets.
 870  	 *
 871  	 * Note: The filter is also evaluated for empty sidebars, and on both the front end

PHP Documentation

<?php
/**
	 * Fires after widgets are rendered in a dynamic sidebar.
	 *
	 * Note: The action also fires for empty sidebars, and on both the front end
	 * and back end, including the Inactive Widgets sidebar on the Widgets screen.
	 *
	 * @since 3.9.0
	 *
	 * @param int|string $index       Index, name, or ID of the dynamic sidebar.
	 * @param bool       $has_widgets Whether the sidebar is populated with widgets.
	 *                                Default true.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/widgets.php
Related Hooks

Related hooks will be displayed here in future updates.