Filter hook 'block_default_classname'

in WP Core File wp-includes/block-supports/generated-classname.php at line 36

View Source

block_default_classname

Filter Hook
Description
Filters the default block className for server rendered blocks.

Hook Information

File Location wp-includes/block-supports/generated-classname.php View on GitHub
Hook Type Filter
Line Number 36

Hook Parameters

Type Name Description
string $class_name The current applied classname.
string $block_name The block name.

Usage Examples

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

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

Source Code Context

wp-includes/block-supports/generated-classname.php:36 - How this hook is used in WordPress core
<?php
  31  	 * @since 5.6.0
  32  	 *
  33  	 * @param string $class_name The current applied classname.
  34  	 * @param string $block_name The block name.
  35  	 */
  36  	$classname = apply_filters( 'block_default_classname', $classname, $block_name );
  37  
  38  	return $classname;
  39  }
  40  
  41  /**

PHP Documentation

<?php
/**
	 * Filters the default block className for server rendered blocks.
	 *
	 * @since 5.6.0
	 *
	 * @param string $class_name The current applied classname.
	 * @param string $block_name The block name.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/block-supports/generated-classname.php
Related Hooks

Related hooks will be displayed here in future updates.