customize_render_partials_response

過濾鉤子
apply_filters( 'customize_render_partials_response', $response, $this, $partials )
引數
  • (array) $response { 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, if `WP_DEBUG_DISPLAY` is enabled. }
    Required:
  • (WP_Customize_Selective_Refresh) $refresh Selective refresh component.
    Required:
  • (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.
    Required:
定義位置
相關勾子
customize_render_partials_beforecustomize_render_partials_aftercustomize_partial_rendercustomize_dynamic_partial_argscustomize_dynamic_partial_class
相關方法
wp_make_content_images_responsive_customizer_mobile_viewport_meta_wp_customize_publish_changesetget_custom_header_markupis_customize_previewthe_custom_header_markup
引入
4.5.0
棄用
-

customize_render_partials_response是WordPress中的一個過濾器,它允許開發者在自定義器中修改部分渲染請求的響應資料。

過濾渲染部分的響應。

外掛可以使用此過濾器來注入$scripts$stylesrenderpartials responseJS事件提供給客戶端,因此如果指令碼和樣式尚未在DOM中排隊,那麼客戶端可以將它們注入到DOM中。

如果外掛做到了這一點,他們將需要注意所有執行<code>document.write()</code>的指令碼,並確保這些指令碼沒有被注入,否則將重寫該函式,否則頁面將被破壞。

外掛應該知道,$scripts$styles最終可能包含在響應中的預設值。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$response = apply_filters( 'customize_render_partials_response', $response, $this, $partials );
$response = apply_filters( 'customize_render_partials_response', $response, $this, $partials );
$response = apply_filters( 'customize_render_partials_response', $response, $this, $partials );

常見問題

FAQs
檢視更多 >