[wp-trac] [WordPress Trac] #36602: Improvement to redirect_canonical with category permalink

WordPress Trac noreply at wordpress.org
Tue Aug 9 00:12:10 UTC 2016


#36602: Improvement to redirect_canonical with category permalink
-------------------------------------------+---------------------------
 Reporter:  spacedmonkey                   |       Owner:  boonebgorges
     Type:  enhancement                    |      Status:  closed
 Priority:  normal                         |   Milestone:  4.6
Component:  Canonical                      |     Version:  3.0
 Severity:  normal                         |  Resolution:  fixed
 Keywords:  has-patch commit dev-reviewed  |     Focuses:
-------------------------------------------+---------------------------
Changes (by boonebgorges):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"38220"]:
 {{{
 #!CommitTicketReference repository="" revision="38220"
 Improve category check in `redirect_canonical()` when permastruct contains
 category slug.

 [37262] changed a check in `redirect_canonical()` so that it checked
 categories in the object cache rather than querying the database. However,
 the check was based on the identity of `WP_Term` objects, which in
 certain cases can be augmented by the main WP query routine, causing
 failures of the `in_array()` check. This caused unnecessary redirects
 for URLs where `is_single()` is true, but the URL is different from the
 post permalink, such as the `embed` endpoint.

 `has_term()` also checks the cache, but does not sufer from this bug.

 Merges [38216] to the 4.6 branch.

 Props cmillerdev.
 Fixes #36602.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36602#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list