Make WordPress Core

Ticket #35209: 35209.2.patch

File 35209.2.patch, 1.3 KB (added by Asgaros, 9 years ago)
  • src/wp-admin/js/post.js

     
    766766
    767767                                buttons.html(buttonsOrig);
    768768                                permalink.html(permalinkOrig);
    769                                 real_slug.val(new_slug);
     769                                real_slug.val($('#editable-post-name-full').text());
    770770                                $( '.edit-slug' ).focus();
    771771                                wp.a11y.speak( postL10n.permalinkSaved );
    772772                        });
  • src/wp-includes/post.php

     
    31463146         */
    31473147        $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
    31483148
    3149         $post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status, $post_type, $post_parent );
     3149        // Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published.
     3150        $post_status_draftsafe = ( ! empty( $post_name ) && in_array( $post_status, array( 'draft', 'pending' ) ) ) ? 'publish' : $post_status;
     3151        $post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status_draftsafe, $post_type, $post_parent );
    31503152
    31513153        // Don't unslash.
    31523154        $post_mime_type = isset( $postarr['post_mime_type'] ) ? $postarr['post_mime_type'] : '';