From 4f92b64b2e15f536b8418f6214ff97442861d559 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 20 Dec 2007 00:48:49 +0000 Subject: [PATCH] Update term counts when future posts are published. fixes #4913 #5488 git-svn-id: http://svn.automattic.com/wordpress/trunk@6425 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-includes/post.php b/wp-includes/post.php index f7d31176bf..91ba23f688 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1168,6 +1168,12 @@ function wp_publish_post($post_id) { $post->post_status = 'publish'; wp_transition_post_status('publish', $old_status, $post); + // Update counts for the post's terms. + foreach ( get_object_taxonomies('post') as $taxonomy ) { + $terms = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids'); + wp_update_term_count($terms, $taxonomy); + } + do_action('edit_post', $post_id, $post); do_action('save_post', $post_id, $post); do_action('wp_insert_post', $post_id, $post);