[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 07:01:49 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                  |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------

Comment (by markjaquith):

 Workaround for plugins that have hierarchical post types and use
 get_posts() or wp_list_pages():

 {{{

 add_action( 'clean_post_cache', 'YOUR_PREFIX_clean_post_cache', 10, 2 );

 function YOUR_PREFIX_clean_post_cache( $post_id, $post ) {
         if ( 'YOUR-POST-TYPE' === $post->post_type )
                 wp_cache_delete( 'get_pages', 'posts' ); // See:
 http://core.trac.wordpress.org/ticket/21279
 }

 }}}

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


More information about the wp-trac mailing list