WordPress.org

Make WordPress Core

Ticket #23074: query.php.patch

File query.php.patch, 824 bytes (added by kitchin, 8 years ago)

Minimal fix

  • wp-includes/query.php

     
    39233923
    39243924                $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']);
    39253925
     3926                // Prevent a simple redirect loop due to values in '_wp_old_slug' not deleted
     3927                // when in an unpublished status.
     3928                $query .= $wpdb->prepare(" AND post_name != %s", $wp_query->query_vars['name']);
     3929
    39263930                // if year, monthnum, or day have been specified, make our query more precise
    39273931                // just in case there are multiple identical _wp_old_slug values
    39283932                if ( '' != $wp_query->query_vars['year'] )