From 2f514a6115be46d4bc053b3dcf04906ccf8a8c0a Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 18 Aug 2015 02:51:26 +0000 Subject: [PATCH] When generating a fallback `post_name` using the post ID, `wp_insert_post()` should clear the post cache immediately. If the post cache is not cleared at this point, the cache can become stale for operations performed before the cache is cleared later in the function. Specifically, the generation of a `guid` for new posts can use stale data, resulting in non-unique values. [33262] introduced a call to `get_post()` that introduced just such an invalidation problem. Fixes #5305. Built from https://develop.svn.wordpress.org/trunk@33630 git-svn-id: http://core.svn.wordpress.org/trunk@33597 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 1 + wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index f15c9e23a5..912a03c8c8 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3455,6 +3455,7 @@ function wp_insert_post( $postarr, $wp_error = false ) { if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) { $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent ); $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); + clean_post_cache( $post_ID ); } if ( is_object_in_taxonomy( $post_type, 'category' ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 38fe74cbb0..def692dfa3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-RC3-33629'; +$wp_version = '4.3-RC3-33630'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.