WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 5 months ago

#35635 new defect (bug)

Redirect loop for custom post types in WP 4.4

Reported by: standuncan Owned by:
Milestone: Priority: normal
Severity: critical Version: 4.4.1
Component: Permalinks Keywords: dev-feedback
Focuses: Cc:
PR Number:

Description

I have a client site hosted on WPE that was on 4.3.1 and when I updated to 4.4.1. it now has a redirect loop error (ERR_TOO_MANY_REDIRECTS) when trying to access a single post page (for a custom post type) from a category page. What it is doing is trying to redirect without the category in the the URL and then tries to redirect with the category, and loops;
/%category%/%postname%/ => /%postname%/ => /%category%/%postname%/ => etc.

On my category page a have a list of posts with links with the markup <a href="<?php the_permalink(); ?>" class="custom">...</a> and my permalinks setup is "Post name" or (/%postname%/).

I don't know the code causing this so I don't have much info, but with the assistance of WPE support we confirmed this is due to the WP 4.4.1 update by cloning versions and updating WP and reverting, etc. Here is another instance I found as well, but they claim to have reinstalled 4.4 and it fixed it. I tried this several times with no luck.

Note: This is my first time submitting a defect/ticket, so please let me know if I need to add any other info.

Change History (2)

#1 @Asif2BD
4 years ago

  • Keywords reporter-feedback dev-feedback added

@standuncan Thanks for the first ticket!

Probably a more detail steps how to recreate it would help.

#2 @standuncan
3 years ago

  • Keywords reporter-feedback removed
  • Severity changed from normal to critical

I'm going to up the severity of this defect, since anyone who is experiencing this problem can not update their WP version and with recent vulnerabilities in this version of WP, it should be updated!

I do not know the exact steps to recreate, but here is my scenario reiterated;

  1. Current version: 4.3.2
  2. Upgrade to version 4.4.1 or anything above;
  3. Permalinks set to "Post name"
  4. I have a category page with this markup in the template;
    <div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    <div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    <div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    <div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    
  5. When I click on one of those single post links above, from that category page, I receive an error stating:
    • Redirect Loop (ERR_TOO_MANY_REDIRECTS)
  6. I can see what is happening is the page is trying to add the category into the URL and then remove it from the URL and loops;
    • /%category%/%postname%/ => /%postname%/ => /%category%/%postname%/ => etc

I don't want to publicly display my client site, but I can provide code, screenshots, dev environment access possibly if it will help in resolving the issue. Thank you!

Note: See TracTickets for help on using tickets.