WordPress.org

Make WordPress Core

Ticket #22902: 22902.2.patch

File 22902.2.patch, 1.5 KB (added by SergeyBiryukov, 5 years ago)

Refreshed

  • wp-admin/includes/ajax-actions.php

     
    13501350        if ( empty($data['ping_status']) )
    13511351                $data['ping_status'] = 'closed';
    13521352
     1353        // Hack: wp_unique_post_slug() doesn't work for 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
    13531359        // update the post
    13541360        edit_post();
    13551361
  • wp-admin/includes/post.php

     
    999999        $original_date = $post->post_date;
    10001000        $original_name = $post->post_name;
    10011001
    1002         // Hack: get_permalink would return ugly permalink for
    1003         // drafts, so we will fake, that our post is published
    1004         if ( in_array($post->post_status, array('draft', 'pending')) ) {
     1002        // Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published.
     1003        if ( in_array( $post->post_status, array( 'draft', 'pending' ) ) ) {
    10051004                $post->post_status = 'publish';
    10061005                $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);
    10071006        }