WordPress.org

Make WordPress Core

Ticket #22902: 22902.3.patch

File 22902.3.patch, 1.6 KB (added by markjaquith, 9 years ago)

refreshed

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

    function wp_ajax_inline_save() { 
    13521352        if ( empty($data['ping_status']) )
    13531353                $data['ping_status'] = 'closed';
    13541354
     1355        // Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published.
     1356        if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ) ) ) {
     1357                $post['post_status'] = 'publish';
     1358                $data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] );
     1359        }
     1360
    13551361        // update the post
    13561362        edit_post();
    13571363
  • wp-admin/includes/post.php

    function get_sample_permalink($id, $title = null, $name = null) { 
    995995        $original_date = $post->post_date;
    996996        $original_name = $post->post_name;
    997997
    998         // Hack: get_permalink would return ugly permalink for
    999         // drafts, so we will fake, that our post is published
    1000         if ( in_array($post->post_status, array('draft', 'pending')) ) {
     998        // Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published.
     999        if ( in_array( $post->post_status, array( 'draft', 'pending' ) ) ) {
    10011000                $post->post_status = 'publish';
    10021001                $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);
    10031002        }