[wp-trac] [WordPress Trac] #35184: 301 infinite redirect loop error on SOME posts
WordPress Trac
noreply at wordpress.org
Mon Dec 21 14:26:14 UTC 2015
#35184: 301 infinite redirect loop error on SOME posts
--------------------------+--------------------------------------------
Reporter: sveralex | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: Permalinks | Version: 4.4
Severity: normal | Resolution: invalid
Keywords: | Focuses: accessibility, administration
--------------------------+--------------------------------------------
Comment (by sveralex):
I'm not sure you're right.
Just found this patch (CORE!), which helped me. But I'm not sure if it
does not impact on other functions.
Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php (revision 26965)
+++ wp-includes/query.php (working copy)
@@ -3923,6 +3923,10 @@
$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']);
+ // Prevent a simple redirect loop due to values in
'_wp_old_slug' not deleted
+ // when in an unpublished status.
+ $query .= $wpdb->prepare(" AND post_name != %s",
$wp_query->query_vars['name']);
+
// if year, monthnum, or day have been specified, make our
query more precise
// just in case there are multiple identical _wp_old_slug
values
if ( '' != $wp_query->query_vars['year'] )
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35184#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list