Filter hook 'customize_dynamic_partial_class'

in WP Core File wp-includes/customize/class-wp-customize-selective-refresh.php at line 251

View Source

customize_dynamic_partial_class

Filter Hook
Description
Filters the class used to construct partials. Allow non-statically created partials to be constructed with custom WP_Customize_Partial subclass.

Hook Information

File Location wp-includes/customize/class-wp-customize-selective-refresh.php View on GitHub
Hook Type Filter
Line Number 251

Hook Parameters

Type Name Description
string $partial_class WP_Customize_Partial or a subclass.
string $partial_id ID for dynamic partial.
array $partial_args The arguments to the WP_Customize_Partial constructor.

Usage Examples

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

function my_custom_filter($partial_class, $partial_id, $partial_args) {
    // Your custom filtering logic here
    return $partial_class;
}

Source Code Context

wp-includes/customize/class-wp-customize-selective-refresh.php:251 - How this hook is used in WordPress core
<?php
 246  			 *
 247  			 * @param string $partial_class WP_Customize_Partial or a subclass.
 248  			 * @param string $partial_id    ID for dynamic partial.
 249  			 * @param array  $partial_args  The arguments to the WP_Customize_Partial constructor.
 250  			 */
 251  			$partial_class = apply_filters( 'customize_dynamic_partial_class', $partial_class, $partial_id, $partial_args );
 252  
 253  			$partial = new $partial_class( $this, $partial_id, $partial_args );
 254  
 255  			$this->add_partial( $partial );
 256  			$new_partials[] = $partial;

PHP Documentation

<?php
/**
			 * Filters the class used to construct partials.
			 *
			 * Allow non-statically created partials to be constructed with custom WP_Customize_Partial subclass.
			 *
			 * @since 4.5.0
			 *
			 * @param string $partial_class WP_Customize_Partial or a subclass.
			 * @param string $partial_id    ID for dynamic partial.
			 * @param array  $partial_args  The arguments to the WP_Customize_Partial constructor.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/customize/class-wp-customize-selective-refresh.php
Related Hooks

Related hooks will be displayed here in future updates.