Ticket #17548: recount.diff
File recount.diff, 2.4 KB (added by , 13 years ago) |
---|
-
wp-includes/default-filters.php
### Eclipse Workspace Patch 1.0 #P WPtrunk
254 254 add_action( 'publish_post', '_publish_post_hook', 5, 1 ); 255 255 add_action( 'save_post', '_save_post_hook', 5, 2 ); 256 256 add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); 257 add_action( 'transition_post_status', 'wp_recount_term_on_post_transition', 10, 3 ); 257 258 add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); 258 259 add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); 259 260 add_action( 'admin_init', 'send_frame_options_header', 10, 0 ); -
wp-includes/post.php
2730 2730 $old_status = $post->post_status; 2731 2731 $post->post_status = 'publish'; 2732 2732 wp_transition_post_status('publish', $old_status, $post); 2733 2734 // Update counts for the post's terms. 2735 foreach ( (array) get_object_taxonomies('post') as $taxonomy ) { 2736 $tt_ids = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'tt_ids')); 2737 wp_update_term_count($tt_ids, $taxonomy); 2738 } 2739 2733 2740 2734 do_action('edit_post', $post_id, $post); 2741 2735 do_action('save_post', $post_id, $post); 2742 2736 do_action('wp_insert_post', $post_id, $post); … … 2979 2973 do_action("{$new_status}_{$post->post_type}", $post->ID, $post); 2980 2974 } 2981 2975 2976 /** 2977 * Call update term counter callback for each post transition. (TODO: to improve) 2978 * 2979 * @since 3.3 2980 * 2981 * @param string $new_status Transition to this post status. 2982 * @param string $old_status Previous post status. 2983 * @param object $post Post data. 2984 */ 2985 function wp_recount_term_on_post_transition( $new_status, $old_status, $post ) { 2986 if ( !apply_filters('recount_term_on_post_transition', true, $new_status, $old_status, $post) ) { 2987 return false; 2988 } 2989 2990 foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) { 2991 $tt_ids = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'tt_ids')); 2992 wp_update_term_count($tt_ids, $taxonomy); 2993 } 2994 2995 return true; 2996 } 2997 2982 2998 // 2983 2999 // Trackback and ping functions 2984 3000 //