From d02f05c3ed8311d29519066ba15f01e077571341 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 11 Dec 2024 23:36:44 +0100 Subject: [PATCH] Triggers --- src/wp-includes/post.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index c945abe8c43e9..51fa08361f04e 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -4985,6 +4985,8 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true ) do_action( 'add_attachment', $post_id ); } + clear_user_posts_count_cache( $post_author, $post_type ); + return $post_id; } @@ -5072,7 +5074,7 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true ) */ do_action( 'wp_insert_post', $post_id, $post, $update ); - clear_user_posts_count_cache( $post->post_author, $post_type ); + clear_user_posts_count_cache( $post_author, $post_type ); if ( $fire_after_hooks ) { wp_after_insert_post( $post, $update, $post_before );