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

WordPress Trac noreply at wordpress.org
Mon Aug 8 18:48:54 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:                |     Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):

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


Comment:

 In [changeset:"38216"]:
 {{{
 #!CommitTicketReference repository="" revision="38216"
 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.

 Props cmillerdev.
 Fixes #36602.
 }}}

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


More information about the wp-trac mailing list