WordPress.org

Make WordPress Core

Ticket #20419: 20419-russian-reversal.patch

File 20419-russian-reversal.patch, 1.2 KB (added by mintindeed, 7 years ago)

Only check for "publish" because that's what we actually care about

  • wp-includes/post.php

     
    28332833 * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
    28342834 */
    28352835function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
    2836         if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
     2836        if ( isset($post_ID->post_status) )
     2837                $post_status = $post_ID->post_status;
     2838
     2839        if ( 'publish' === $post_status )
    28372840                return $slug;
    28382841
    28392842        global $wpdb, $wp_rewrite;
  • 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, 'sample-' . $post->post_status, $post->post_type, $post->post_parent );
    10381038
    10391039        $post->filter = 'sample';
    10401040