apply_filters( 'customize_render_partials_response', array $response, WP_Customize_Selective_Refresh $refresh, array $partials )
- Since
- 4.5.0
Description
Plugins may use this filter to inject $scripts and $styles, which are dependencies for the partials being rendered. The response data will be available to the client via the render-partials-response JS event, so the client can then inject the scripts and styles into the DOM if they have not already been enqueued there.
If plugins do this, they'll need to take care for any scripts that do document.write() and make sure that these are not injected, or else to override the function to no-op, or else the page will be destroyed.
Plugins should be aware that $scripts and $styles may eventually be included by default in the response.
Compatibility
- WordPress
- since 4.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$responsearray- { Response.
@type array $contents Associative array mapping a partial ID its corresponding array of contents for the containers requested.
@type array $errors List of errors triggered during rendering of partials, ifWP_DEBUG_DISPLAYis enabled.
}$contentsarrayAssociative array mapping a partial ID its corresponding array of contents for the containers requested.$errorsarrayList of errors triggered during rendering of partials, ifWP_DEBUG_DISPLAYis enabled.
$refreshWP_Customize_Selective_Refresh- Selective refresh component.
$partialsarray- Placements' context data for the partials rendered in the request.
The array is keyed by partial ID, with each item being an array of the placements' context data.
Where this hook fires · 1
wp-includes/customize/class-wp-customize-selective-refresh.php:437WP_Customize_Selective_Refresh::handle_render_partials_request()
Source code
* } * @param WP_Customize_Selective_Refresh $refresh Selective refresh component. * @param array $partials Placements' context data for the partials rendered in the request. * The array is keyed by partial ID, with each item being an array of * the placements' context data. */ $response = apply_filters( 'customize_render_partials_response', $response, $this, $partials ); wp_send_json_success( $response ); }}Changelog
Introduced in 4.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.