钩子文档

customize_render_partials_after

💡 云策文档标注

概述

customize_render_partials_after 是一个 WordPress 动作钩子,在部分内容渲染后立即触发,主要用于插件处理脚本输出和响应过滤。

关键要点

  • 触发时机:在部分内容渲染后立即执行。
  • 主要用途:插件可以调用 wp_footer() 等函数来收集脚本输出,并通过 'customize_render_partials_response' 过滤器返回。
  • 参数:$refresh(WP_Customize_Selective_Refresh 对象)和 $partials(数组,键为部分 ID,值为放置上下文数据)。
  • 相关函数:WP_Customize_Selective_Refresh::handle_render_partials_request() 用于处理 Ajax 请求以返回渲染的部分内容。
  • 版本历史:从 WordPress 4.5.0 版本引入。

📄 原文内容

Fires immediately after partials are rendered.

Description

Plugins may do things like call wp_footer() to scrape scripts output and return them via the ‘customize_render_partials_response’ filter.

Parameters

$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.

Source

do_action( 'customize_render_partials_after', $this, $partials );

Changelog

Version Description
4.5.0 Introduced.