mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Revert [18783], as it breaks term relationship counts for attachment taxonomies. see #17548.
git-svn-id: https://develop.svn.wordpress.org/trunk@18809 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+6
-16
@@ -2727,6 +2727,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 ( (array) get_object_taxonomies('post') as $taxonomy ) {
|
||||
$tt_ids = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'tt_ids'));
|
||||
wp_update_term_count($tt_ids, $taxonomy);
|
||||
}
|
||||
|
||||
do_action('edit_post', $post_id, $post);
|
||||
do_action('save_post', $post_id, $post);
|
||||
do_action('wp_insert_post', $post_id, $post);
|
||||
@@ -5305,20 +5311,4 @@ function _post_format_wp_get_object_terms( $terms ) {
|
||||
}
|
||||
add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
|
||||
|
||||
/**
|
||||
* Update the custom taxonomies' term counts when a post's status is changed. For example, default posts term counts (for custom taxonomies) don't include private / draft posts.
|
||||
*
|
||||
* @access private
|
||||
* @param string $new_status
|
||||
* @param string $old_status
|
||||
* @param object $post
|
||||
* @since 3.3.0
|
||||
*/
|
||||
function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) {
|
||||
// Update counts for the post's terms.
|
||||
foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
|
||||
$tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) );
|
||||
wp_update_term_count( $tt_ids, $taxonomy );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user