Make WordPress Core


Ignore:
Timestamp:
08/18/2015 02:50:23 AM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r33555 r33630  
    34563456        $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent );
    34573457        $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
     3458        clean_post_cache( $post_ID );
    34583459    }
    34593460
Note: See TracChangeset for help on using the changeset viewer.