widget_block_dynamic_classname filter-hookWP 5.8.0

The classname used in the block widget's container HTML.

This can be set according to the name of the block contained by the block widget.

Usage

add_filter( 'widget_block_dynamic_classname', 'wp_kama_widget_block_dynamic_classname_filter', 10, 2 );

/**
 * Function for `widget_block_dynamic_classname` filter-hook.
 * 
 * @param string $classname  The classname to be used in the block widget's container HTML, e.g. 'widget_block widget_text'.
 * @param string $block_name The name of the block contained by the block widget, e.g. 'core/paragraph'.
 *
 * @return string
 */
function wp_kama_widget_block_dynamic_classname_filter( $classname, $block_name ){

	// filter...
	return $classname;
}
$classname(string)
The classname to be used in the block widget's container HTML, e.g. 'widget_block widget_text'.
$block_name(string)
The name of the block contained by the block widget, e.g. 'core/paragraph'.

Changelog

Since 5.8.0 Introduced.

Where the hook is called

WP_Widget_Block::get_dynamic_classname()
widget_block_dynamic_classname
wp-includes/widgets/class-wp-widget-block.php 167
return apply_filters( 'widget_block_dynamic_classname', $classname, $block_name );

Where the hook is used in WordPress

Usage not found.