Make WordPress Core

Ticket #20419: 20419-extra-param.patch

File 20419-extra-param.patch, 1.8 KB (added by mintindeed, 12 years ago)

updated version of original patch

  • wp-includes/post.php

     
    28302830 * @param string $post_status no uniqueness checks are made if the post is still draft or pending
    28312831 * @param string $post_type
    28322832 * @param integer $post_parent
     2833 * @param string $real_status Because this function bails on non-published statuses, this gives
     2834 *     the ability to pass a fake "publish" status via $post_status while sending the real status
     2835 *     to the wp_unique_post_slug filter
    28332836 * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
    28342837 */
    2835 function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
     2838function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $real_status = null ) {
    28362839        if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
    28372840                return $slug;
    28382841
     2842        // If $real_status string was passed, we can now return the $post_status to
     2843        // the real status.
     2844        if ( $real_status && is_string( $real_status ) )
     2845                $post_status = $real_status;
     2846
    28392847        global $wpdb, $wp_rewrite;
    28402848
    28412849        $original_slug = $slug;
  • wp-admin/includes/post.php

     
    10341034        if ( !is_null($name) )
    10351035                $post->post_name = sanitize_title($name ? $name : $title, $post->ID);
    10361036
    1037         $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
     1037        $post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent, $original_status );
    10381038
    10391039        $post->filter = 'sample';
    10401040