Ticket #11399: 11399.sw.2.diff
File 11399.sw.2.diff, 3.4 KB (added by , 13 years ago) |
---|
-
wp-includes/default-filters.php
249 249 add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); 250 250 add_action( 'pre_post_update', 'wp_save_post_revision' ); 251 251 add_action( 'publish_post', '_publish_post_hook', 5, 1 ); 252 add_action( 'save_post', '_save_post_hook', 5, 2 );253 252 add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); 254 253 add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 ); 255 254 add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); -
wp-includes/post.php
2100 2100 2101 2101 clean_post_cache( $post ); 2102 2102 2103 if ( is_post_type_hierarchical( $post->post_type ) ) {2104 foreach ( (array) $children as $child )2105 clean_post_cache( $child );2106 }2107 2108 2103 wp_clear_scheduled_hook('publish_future_post', array( $postid ) ); 2109 2104 2110 2105 do_action('after_delete_post', $postid); … … 2772 2767 * Publish a post by transitioning the post status. 2773 2768 * 2774 2769 * @since 2.1.0 2775 * @uses $wpdb 2776 * @uses do_action() Calls 'edit_post', 'save_post', and 'wp_insert_post' on post_id and post data. 2770 * @uses wp_update_post() 2777 2771 * 2778 * @param int $post_id Post ID.2772 * @param int|object $post Post ID or Post object. 2779 2773 * @return null 2780 2774 */ 2781 function wp_publish_post($post_id) { 2782 global $wpdb; 2783 2784 $post = get_post($post_id); 2785 2786 if ( empty($post) ) 2787 return; 2788 2789 if ( 'publish' == $post->post_status ) 2775 function wp_publish_post($post) { 2776 $post = get_post( $post ); 2777 if ( empty( $post ) ) 2790 2778 return; 2791 2792 $wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post_id ) ); 2793 2794 $old_status = $post->post_status; 2795 $post->post_status = 'publish'; 2796 wp_transition_post_status('publish', $old_status, $post); 2797 2798 do_action('edit_post', $post_id, $post); 2799 do_action('save_post', $post_id, $post); 2800 do_action('wp_insert_post', $post_id, $post); 2779 wp_update_post( array( 'ID' => $post->ID, 'post_status' => 'publish' ) ); 2801 2780 } 2802 2781 2803 2782 /** … … 4408 4387 do_action( 'clean_page_cache', $post->ID ); 4409 4388 } 4410 4389 4411 if ( $children = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_type FROM $wpdb->posts WHERE post_parent = %d ", $post->ID) ) ) {4390 if ( $children = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_type FROM $wpdb->posts WHERE post_parent = %d AND post_type <> 'revision' ", $post->ID) ) ) { 4412 4391 foreach ( $children as $child ) { 4413 4392 // Loop detection 4414 4393 if ( $child->ID == $post->ID ) … … 4615 4594 } 4616 4595 4617 4596 /** 4618 * Hook used to prevent page/post cache from staying dirty when a post is saved.4619 *4620 * @since 2.3.04621 * @access private4622 *4623 * @param int $post_id The ID in the database table for the $post4624 * @param object $post Object type containing the post information4625 */4626 function _save_post_hook( $post_id, $post ) {4627 clean_post_cache( $post );4628 }4629 4630 /**4631 4597 * Retrieve post ancestors and append to post ancestors property. 4632 4598 * 4633 4599 * Will only retrieve ancestors once, if property is already set, then nothing