rest_prepare_block_type

過濾鉤子
apply_filters( 'rest_prepare_block_type', $response, $block_type, $request )
引數
  • (WP_REST_Response) $response The response object.
    Required:
  • (WP_Block_Type) $block_type The original block type object.
    Required:
  • (WP_REST_Request) $request Request used to generate the response.
    Required:
定義位置
相關勾子
rest_prepare_block_patternrest_prepare_post_typerest_prepare_widget_typerest_prepare_themeregister_block_type_args
相關方法
register_block_typeunregister_block_typeregister_block_styleunregister_block_styleget_allowed_block_typesregister_block_style_handle
引入
5.5.0
棄用
-

rest_prepare_block_type: 這是WordPress中的一個動作鉤子,當REST API正在準備響應的塊型別時被觸發。它允許開發者在返回之前修改塊型別的資料。

過濾從REST API返回的區塊型別。

允許在返回前修改區塊型別的資料。

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

常見問題

FAQs
檢視更多 >