rest_prepare_widget_type

過濾鉤子
apply_filters( 'rest_prepare_widget_type', $response, $widget_type, $request )
引數
  • (WP_REST_Response) $response The response object.
    Required:
  • (array) $widget_type The array of widget data.
    Required:
  • (WP_REST_Request) $request The request object.
    Required:
定義位置
相關勾子
rest_prepare_widgetrest_prepare_post_typerest_prepare_block_typerest_prepare_sidebarrest_prepare_this-post_type
相關方法
register_widgetrest_parse_dateretrieve_widgetsregister_widget_controlunregister_widgetwp_parse_widget_id
引入
5.8.0
棄用
-

rest_prepare_widget_type – 這個鉤子用於修改由REST API返回的widget型別資料結構。每當通過REST API查詢一個單一的widget型別,並在返回響應之前,這個鉤子就會被觸發。它為開發者提供了一種方法來修改由API返回的小工具型別的資料。

過濾一個小工具型別的REST API響應。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
return apply_filters( 'rest_prepare_widget_type', $response, $widget_type, $request );
return apply_filters( 'rest_prepare_widget_type', $response, $widget_type, $request );
return apply_filters( 'rest_prepare_widget_type', $response, $widget_type, $request );

常見問題

FAQs
檢視更多 >