customize_partial_render_{$partial->id}
云策文档标注
概述
customize_partial_render_{$partial->id} 是一个 WordPress 过滤器钩子,用于自定义特定 partial 的渲染输出。它允许开发者在渲染过程中修改或替换 partial 的内容。
关键要点
- 这是一个动态钩子,钩子名称中的 $partial->id 指代 partial 的 ID。
- 主要参数包括 $rendered(渲染值,默认为 false)、$partial(WP_Customize_Partial 实例)和 $container_context(可选上下文数组)。
- 常用于 WP_Customize_Partial::render() 方法中,以控制自定义器中的 partial 渲染。
- 自 WordPress 4.5.0 版本引入。
原文内容
Filters partial rendering for a specific partial.
Description
The dynamic portion of the hook name, $partial->ID refers to the partial ID.
Parameters
$renderedstring|array|false-
The partial value. Default false.
$partialWP_Customize_Partial-
WP_Customize_Setting instance.
$container_contextarray-
Optional array of context data associated with the target container.
Source
$rendered = apply_filters( "customize_partial_render_{$partial->id}", $rendered, $partial, $container_context );
Changelog
| Version | Description |
|---|---|
| 4.5.0 | Introduced. |