WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 12 days ago

Last modified 12 days ago

#33356 closed enhancement (wontfix)

template_redirect hook for redirect_canonical() running too late

Reported by: mikelopez Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Canonical Keywords:
Focuses: Cc:
PR Number:

Description

Hi

The template_redirect for redirect_canonical() currently runs with default priority.

I believe it should run with a priority of 1 for the following reasons:

  • Any other plugin/theme hooking to template_redirect with a higher priority will run under the wrong canonical URL.
  • Furthermore, if the plugin/theme needs to check for the current user, then it will only see that there is no user logged in because no cookie are set due to the browser being on the wrong URL at this point.
  • redirect_canonical() is a pretty important function and having the proper canonical URL before anything else probably have more pros than cons.

Thoughts?

Thanks.

Mike

Change History (5)

This ticket was mentioned in Slack in #core by noisysocks. View the logs.


12 days ago

#2 @talldanwp
12 days ago

  • Keywords reporter-feedback added

Hey @mikelopez, Thanks for creating the ticket, and apologies it took a while for a response.

This ticket was discussed in a triage session in slack (the link is above this message).

One concern with changing the priority is it could lead to some backwards compatibility issues if other code relies on the current behaviour.

Is this currently causing a bug, or is it something you feel could be improved?

#3 @mikelopez
12 days ago

Hi @talldanwp

No worries. I know you guys are busy. I think this can be closed. It's been a while and I can't remember the exact details but it was a conflict between a theme (can't remember too) and WishList Member.

I'll open another ticket with more detail if we encounter this again.

Thanks.

#4 @talldanwp
12 days ago

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

Thanks @mikelopez, will close this now.

#5 @SergeyBiryukov
12 days ago

  • Component changed from General to Canonical
  • Keywords reporter-feedback removed
Note: See TracTickets for help on using tickets.