WordPress.org

Make WordPress Core

Ticket #35031: 35031.diff

File 35031.diff, 758 bytes (added by pento, 4 years ago)
  • src/wp-includes/query.php

     
    49784978                if ( is_post_type_hierarchical( $post_type ) )
    49794979                        return;
    49804980
     4981                // If the post already exists, we shouldn't try to redirect
     4982                if ( get_posts( array( 'name' => $wp_query->query_vars['name'], 'post_type' => $post_type ) ) ) {
     4983                        return;
     4984                }
     4985
    49814986                $query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['name']);
    49824987
    49834988                // if year, monthnum, or day have been specified, make our query more precise