customize_dynamic_partial_class WordPress Filter Hook

The customize_dynamic_partial_class hook allows you to change the class used to identify a dynamic partial. A dynamic partial is a partial that is rendered using the render_partial() function. By default, the class used to identify a dynamic partial is 'WP_Customize_Partial'. However, if you want to use a different class for your dynamic partial, you can use the customize_dynamic_partial_class hook. For example, if you want to use the 'My_Custom_Partial' class for your dynamic partial, you would use the following code: function my_customize_dynamic_partial_class( $class ) { return 'My_Custom_Partial'; } add_filter( 'customize_dynamic_partial_class', 'my_customize_dynamic_partial_class' );

apply_filters( 'customize_dynamic_partial_class', string $partial_class, string $partial_id, array $partial_args ) #

Filters the class used to construct partials.


Description

Allow non-statically created partials to be constructed with custom WP_Customize_Partial subclass.


Top ↑

Parameters

$partial_class

(string)WP_Customize_Partial or a subclass.

$partial_id

(string)ID for dynamic partial.

$partial_args

(array)The arguments to the WP_Customize_Partial constructor.


Top ↑

Source

File: wp-includes/customize/class-wp-customize-selective-refresh.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.