rest_prepare_block_pattern

過濾鉤子
apply_filters( 'rest_prepare_block_pattern', $response, $raw_pattern, $request )
引數
  • (WP_REST_Response) $response The response object.
    Required:
  • (object) $raw_pattern The unprepared block pattern.
    Required:
  • (WP_REST_Request) $request The request object.
    Required:
定義位置
相關勾子
rest_prepare_block_typerest_prepare_attachmentrest_prepare_menu_locationrest_prepare_post_typerest_prepare_comment
相關方法
_register_theme_block_patternsregister_block_core_patternrender_block_core_pattern_load_remote_block_patternsregister_block_typeregister_block_style
引入
5.8.0
棄用
-

rest_prepare_block_pattern是WordPress REST API的一個動作鉤子,在準備作為REST API響應的一部分返回的塊模式時被呼叫。這個鉤子被呼叫時只有一個引數,那就是代表塊模式的WP_REST_Response類的例項。開發者可以使用這個鉤子在REST API響應中返回之前修改塊模式的資料。

過濾REST API響應的區塊樣板。

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

常見問題

FAQs
檢視更多 >