Filter hook 'dynamic_sidebar_params'

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

View Source

dynamic_sidebar_params

Filter Hook
Description
Calls the render callback of a widget and returns the output.

Hook Information

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

Hook Parameters

Type Name Description
string $widget_id Widget ID.
string $sidebar_id Sidebar ID.

Usage Examples

Basic Usage
<?php
// Hook into dynamic_sidebar_params
add_filter('dynamic_sidebar_params', 'my_custom_filter', 10, 2);

function my_custom_filter($widget_id, $sidebar_id) {
    // Your custom filtering logic here
    return $widget_id;
}

Source Code Context

wp-includes/widgets.php:2031 - How this hook is used in WordPress core
<?php
2026  	}
2027  	$classname_                 = ltrim( $classname_, '_' );
2028  	$params[0]['before_widget'] = sprintf( $params[0]['before_widget'], $widget_id, $classname_ );
2029  
2030  	/** This filter is documented in wp-includes/widgets.php */
2031  	$params = apply_filters( 'dynamic_sidebar_params', $params );
2032  
2033  	$callback = $wp_registered_widgets[ $widget_id ]['callback'];
2034  
2035  	ob_start();
2036  

PHP Documentation

<?php
/**
 * Calls the render callback of a widget and returns the output.
 *
 * @since 5.8.0
 *
 * @global array $wp_registered_widgets  The registered widgets.
 * @global array $wp_registered_sidebars The registered sidebars.
 *
 * @param string $widget_id Widget ID.
 * @param string $sidebar_id Sidebar ID.
 * @return string
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/widgets.php
Related Hooks

Related hooks will be displayed here in future updates.