Make WordPress Core

Ticket #20419: ticket.20419.patch

File ticket.20419.patch, 1.8 KB (added by mintindeed, 12 years ago)
  • wp-includes/post.php

     
    27902790 * @param string $post_status no uniqueness checks are made if the post is still draft or pending
    27912791 * @param string $post_type
    27922792 * @param integer $post_parent
     2793 * @param string $real_status Because this function bails on non-published statuses, this
     2794 *    gives the ability to pass a fake "publish" status via $post_status while sending the
     2795 *    real status to the wp_unique_post_slug filter
    27932796 * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
    27942797 */
    2795 function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
     2798function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $real_status = null ) {
    27962799        if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
    27972800                return $slug;
    27982801
     2802        // If $real_status string was passed, we can now return the $post_status to
     2803        // the real status.
     2804        if ( $real_status && is_string( $real_status ) )
     2805                $post_status = $real_status;
     2806
    27992807        global $wpdb, $wp_rewrite;
    28002808
    28012809        $feeds = $wp_rewrite->feeds;
  • wp-admin/includes/post.php

     
    10321032        if ( !is_null($name) )
    10331033                $post->post_name = sanitize_title($name ? $name : $title, $post->ID);
    10341034
    1035         $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
     1035        $post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent, $original_status );
    10361036
    10371037        $post->filter = 'sample';
    10381038