customize_render_partials_response
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
apply_filters( 'customize_render_partials_response', array $response, WP_Customize_Selective_Refresh $refresh, array $partials )
Описание
Плагины могут использовать этот фильтр для внедрения $scripts и $styles, которые являются зависимостями отрисовываемых partials. Данные ответа будут доступны клиенту через JS-событие render-partials-response, после чего клиент сможет внедрить скрипты и стили в DOM, если они там ещё не поставлены в очередь подключения.
Если плагины делают это, им нужно позаботиться о любых скриптах, вызывающих document.write(), и убедиться, что они не внедряются, либо переопределить функцию как пустую, иначе страница будет разрушена.
Плагинам следует учитывать, что $scripts и $styles со временем могут быть включены в ответ по умолчанию.
Оригинал (английский)
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.
Фильтруемое значение
Параметры
$response
array
обязательный
$refresh
WP_Customize_Selective_Refresh
обязательный
$partials
array
обязательный
Исходный код
wp-includes/customize/class-wp-customize-selective-refresh.php:437
$response = apply_filters( 'customize_render_partials_response', $response, $this, $partials );
История изменений
| Версия | Описание |
|---|---|
| 4.5.0 | Introduced. |

