wp_after_insert_post
函数
wp_after_insert_post ( $post, $update, $post_before )
- 参数
-
-
(int|WP_Post)
$post
The post ID or object that has been saved.- Required: 是
-
(bool)
$update
Whether this is an existing post being updated.- Required: 是
-
(null|WP_Post)
$post_before
Null for new posts, the WP_Post object prior to the update for updated posts.- Required: 是
-
(int|WP_Post)
- 定义位置
-
-
wp-includes/post.php
, line 5419
-
wp-includes/post.php
- 引入
- 5.6.0
- 弃用
- –
Fires actions after a post, its terms and meta data has been saved.
function wp_after_insert_post( $post, $update, $post_before ) {
$post = get_post( $post );
if ( ! $post ) {
return;
}
$post_id = $post->ID;
/**
* Fires once a post, its terms and meta data has been saved.
*
* @since 5.6.0
*
* @param int $post_id Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated.
* @param null|WP_Post $post_before Null for new posts, the WP_Post object prior
* to the update for updated posts.
*/
do_action( 'wp_after_insert_post', $post_id, $post, $update, $post_before );
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。