Filter hook 'get_block_type_variations'

in WP Core File wp-includes/class-wp-block-type.php at line 616

View Source

get_block_type_variations

Filter Hook
Description
Filters the registered variations for a block type.

Hook Information

File Location wp-includes/class-wp-block-type.php View on GitHub
Hook Type Filter
Line Number 616

Hook Parameters

Type Name Description
array $variations Array of registered variations for a block type.
WP_Block_Type $block_type The full block type object.

Usage Examples

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

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

Source Code Context

wp-includes/class-wp-block-type.php:616 - How this hook is used in WordPress core
<?php
 611  		 * @since 6.5.0
 612  		 *
 613  		 * @param array         $variations Array of registered variations for a block type.
 614  		 * @param WP_Block_Type $block_type The full block type object.
 615  		 */
 616  		return apply_filters( 'get_block_type_variations', $this->variations, $this );
 617  	}
 618  
 619  	/**
 620  	 * Get block uses context.
 621  	 *

PHP Documentation

<?php
/**
		 * Filters the registered variations for a block type.
		 *
		 * @since 6.5.0
		 *
		 * @param array         $variations Array of registered variations for a block type.
		 * @param WP_Block_Type $block_type The full block type object.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-block-type.php
Related Hooks

Related hooks will be displayed here in future updates.