rest_insert_{$this->post_type}

动作钩子


do_action( "rest_insert_{$this->post_type}", $post, $request, true )
参数
  • (WP_Post)
    $post
    Inserted or updated post object.
    Required:
  • (WP_REST_Request)
    $request
    Request object.
    Required:
  • (bool)
    $creating
    True when creating a post, false when updating.
    Required:
定义位置
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    , line 709
引入
4.7.0
弃用

在通过REST API创建或更新一个帖子后启动。

钩子名称的动态部分, $this->post_type,指的是文章类型slug。

可能的钩子名称包括:

  • rest_insert_post
  • rest_insert_page
  • rest_insert_attachment
do_action( "rest_insert_{$this->post_type}", $post, $request, true );