[wp-trac] [WordPress Trac] #36723: Add caching to wp_old_slug_redirect

WordPress Trac noreply at wordpress.org
Sun May 1 08:36:34 UTC 2016


#36723: Add caching to wp_old_slug_redirect
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Posts, Post Types                    |  Review
 Severity:  normal                               |     Version:  2.1
 Keywords:  has-patch dev-feedback needs-unit-   |  Resolution:
  tests                                          |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by spacedmonkey):

 I miss spoke when I said it was on every page load. I meant it hooked on
 template redirect on every page load.

 So a little back story on this. I run a large high traffic multisite. Lots
 of editorial teams. I also use object caching to help with performance.
 While looking into sql log I found a high number of calls to this sql
 query. We don't cache 404s in our cdn, so this function is results in a
 high amount of sql traffic.

 I am not sure it is possible to cache the redirect it's self. After
 getting the post ID it calls get permalink. The value of the permalink can
 be dynamic, as either it is filtered or the home_url changes, (ssl or
 domain mapping). I think that just save the result of sql is the best
 option, as it lets those filters run and doesn't break backwards
 compatibility.

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


More information about the wp-trac mailing list