WordPress.org

Make WordPress Core

Ticket #22902: 22902.patch

File 22902.patch, 761 bytes (added by SergeyBiryukov, 19 months ago)
  • wp-admin/includes/ajax-actions.php

     
    13491349        if ( empty($data['ping_status']) ) 
    13501350                $data['ping_status'] = 'closed'; 
    13511351 
     1352        // Hack: wp_unique_post_slug() doesn't work for 
     1353        // drafts, so we will fake, that our post is published 
     1354        if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ) ) ) { 
     1355                $post['post_status'] = 'publish'; 
     1356                $data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] ); 
     1357        } 
     1358 
    13521359        // update the post 
    13531360        edit_post(); 
    13541361