customize_render_partials_response WordPress Filter Hook

The customize_render_partials_response WordPress hook is used to filter the response data before it is sent back to the client. This hook is useful for modifying the response data before it is used to render the partial templates.

apply_filters( 'customize_render_partials_response', array $response, WP_Customize_Selective_Refresh $refresh, array $partials ) #

Filters the response from rendering the partials.


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.


Top ↑

Parameters

$response

(array)Response.

  • 'contents'
    (array) Associative array mapping a partial ID its corresponding array of contents for the containers requested.
  • 'errors'
    (array) List of errors triggered during rendering of partials, if WP_DEBUG_DISPLAY is enabled.

$refresh

(WP_Customize_Selective_Refresh)Selective refresh component.

$partials

(array)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.


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.