When creating a new post with an empty post_name and post_title, don't generate a post_name that conflicts with a date archive permalink.

See #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@33261 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-07-14 12:27:03 +00:00
parent 7711b72639
commit c718849baa
2 changed files with 24 additions and 1 deletions

View File

@@ -3451,7 +3451,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'] = sanitize_title( $data['post_title'], $post_ID );
$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 );
}