[wp-trac] [WordPress Trac] #21279: get_pages() does not clear cache items when non-Page hierarchical post types are updated

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 15 06:36:51 UTC 2012


#21279: get_pages() does not clear cache items when non-Page hierarchical post
types are updated
--------------------------+-----------------
 Reporter:  markjaquith   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  high          |  Milestone:  3.5
Component:  Cache         |    Version:
 Severity:  major         |   Keywords:
--------------------------+-----------------
 {{{wp_list_pages()}}} takes a {{{post_type}}} argument (it works with any
 hierarchical post type). {{{wp_list_pages()}}} is powered by
 {{{get_pages()}}}. {{{get_pages()}}} has object caching. When a Page
 changes (edit, create, delete), this cache is cleared, via
 {{{clean_post_cache()}}}. But it is '''not''' cleared for non-Page post
 types. Thus you get stuck with old data.

 Here's the offending code:

 {{{
         if ( 'page' == $post->post_type ) {
                 wp_cache_delete( 'all_page_ids', 'posts' );
                 wp_cache_delete( 'get_pages', 'posts' );
                 do_action( 'clean_page_cache', $post->ID );
         }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21279>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list