widget_block_dynamic_classname
Filter HookDescription
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.Hook Information
| File Location |
wp-includes/widgets/class-wp-widget-block.php
View on GitHub
|
| Hook Type | Filter |
| Line Number | 167 |
Hook Parameters
| Type | Name | Description |
|---|---|---|
string
|
$classname
|
The classname to be used in the block widget's container HTML, e.g. 'widget_block widget_text'. |
string
|
$block_name
|
The name of the block contained by the block widget, e.g. 'core/paragraph'. |
Usage Examples
Basic Usage
<?php
// Hook into widget_block_dynamic_classname
add_filter('widget_block_dynamic_classname', 'my_custom_filter', 10, 2);
function my_custom_filter($classname, $block_name) {
// Your custom filtering logic here
return $classname;
}
Source Code Context
wp-includes/widgets/class-wp-widget-block.php:167
- How this hook is used in WordPress core
<?php
162 * @param string $classname The classname to be used in the block widget's container HTML,
163 * e.g. 'widget_block widget_text'.
164 * @param string $block_name The name of the block contained by the block widget,
165 * e.g. 'core/paragraph'.
166 */
167 return apply_filters( 'widget_block_dynamic_classname', $classname, $block_name );
168 }
169
170 /**
171 * Handles updating settings for the current Block widget instance.
172 *
PHP Documentation
<?php
/**
* 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.
*
* @since 5.8.0
*
* @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'.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/widgets/class-wp-widget-block.php
Related Hooks
Related hooks will be displayed here in future updates.