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
This commit is contained in:
parent
6b9b32c431
commit
2f514a6115
|
@ -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' ) ) ) {
|
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 );
|
$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 );
|
$wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
|
||||||
|
clean_post_cache( $post_ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_object_in_taxonomy( $post_type, 'category' ) ) {
|
if ( is_object_in_taxonomy( $post_type, 'category' ) ) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue