rest_{$this->post_type}_item_schema

過濾鉤子
apply_filters( "rest_{$this->post_type}_item_schema", $schema )

rest_{$this->post_type}_item_schema: 這是WordPress中的一個過濾鉤子,當REST API在生成特定文章型別的單個文章資源的模式時被觸發。鉤子名稱中的”{$this->post_type}”部分被替換為文章型別的實際名稱。它允許開發者在文章資源被返回之前修改其模式。

過濾文章的架構。

過濾器的動態部分$this->post_type,指控制器的post-type slug。

可能的鉤子名稱包括:

  • rest_post_item_schema
  • rest_page_item_schema
  • rest_attachment_item_schema
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$schema = apply_filters( "rest_{$this->post_type}_item_schema", $schema );
$schema = apply_filters( "rest_{$this->post_type}_item_schema", $schema );
$schema = apply_filters( "rest_{$this->post_type}_item_schema", $schema );

常見問題

FAQs
檢視更多 >