WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#35184 closed defect (bug) (duplicate)

301 infinite redirect loop error on SOME posts

Reported by: sveralex Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Permalinks Keywords:
Focuses: Cc:

Change History (4)

#1 @Clorith
3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Hi and welcome to Trac.

Since it's not a consistent problem, it sounds like a support question, and not a core issue. Trac is intended for organizing the work on features and problems with WordPress core.

For support requests please see our forums at https://wordpress.org/support where someone will be able to assist you and go through proper troubleshooting steps to help you sort this out.

#2 @sveralex
3 years ago

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'] ) 
Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
3 years ago

  • Focuses accessibility administration removed
  • Resolution changed from invalid to duplicate

Hi @sveralex,

Thanks for the report, we're already tracking this issue in #35012 and #35031.

#4 @swissspidy
3 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.