Call clean_post_cache() in wp_insert_post() after the manual query to change GUID. Remove the second call to clean_post_cache() previously done on the save_post hook. see #11399.

git-svn-id: http://core.svn.wordpress.org/trunk@21943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-21 18:52:15 +00:00
parent a4831c82f0
commit 5a362d3ace
3 changed files with 10 additions and 16 deletions

View File

@ -249,7 +249,6 @@ add_action( 'plugins_loaded', 'wp_maybe_load_embeds',
add_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
add_action( 'pre_post_update', 'wp_save_post_revision' );
add_action( 'publish_post', '_publish_post_hook', 5, 1 );
add_action( 'save_post', '_save_post_hook', 5, 2 );
add_action( 'transition_post_status', '_transition_post_status', 5, 3 );
add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 );
add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' );

View File

@ -3244,3 +3244,11 @@ function user_pass_ok($user_login, $user_pass) {
return true;
}
/**
* Callback formerly fired on the save_post hook. No longer needed.
*
* @since 2.3.0
* @deprecated 3.5.0
*/
function _save_post_hook() {}

View File

@ -2765,12 +2765,12 @@ function wp_insert_post($postarr, $wp_error = false) {
$current_guid = get_post_field( 'guid', $post_ID );
clean_post_cache( $post_ID );
// Set GUID
if ( !$update && '' == $current_guid )
$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
clean_post_cache( $post_ID );
$post = get_post($post_ID);
if ( !empty($page_template) && 'page' == $data['post_type'] ) {
@ -4684,19 +4684,6 @@ function _publish_post_hook($post_id) {
wp_schedule_single_event(time(), 'do_pings');
}
/**
* Hook used to prevent page/post cache from staying dirty when a post is saved.
*
* @since 2.3.0
* @access private
*
* @param int $post_id The ID in the database table for the $post
* @param object $post Object type containing the post information
*/
function _save_post_hook( $post_id, $post ) {
clean_post_cache( $post );
}
/**
* Determines which fields of posts are to be saved in revisions.
*