[wp-trac] [WordPress Trac] #10381: post->ancestors isn't always set

WordPress Trac wp-trac at lists.automattic.com
Sun Oct 25 11:06:54 UTC 2009

#10381: post->ancestors isn't always set
 Reporter:  Denis-de-Bernardy  |       Owner:  ryan                              
     Type:  defect (bug)       |      Status:  new                               
 Priority:  normal             |   Milestone:  2.9                               
Component:  Cache              |     Version:  2.8                               
 Severity:  normal             |    Keywords:  reporter-feedback needs-unit-tests
Changes (by westi):

 * cc: westi (added)
  * keywords:  has-patch => reporter-feedback needs-unit-tests


 Patch still applies.

 If I understand correctly the issue here is that when we run the main
 Query we cache posts without fetching ancestor information so when we call
 get_post to get the info it it is in the cache we then return the cached
 data which is ancestor less.

 So the question is should we fix that here by checking every cached post
 for ancestor info and thereby running the ancestor update query for the
 first get_post call for these posts or should we always pre-cache the
 ancestor info when querying.

 It looks like all other calls to _get_post_ancestors are in get_post so
 this would be the place to fix it.

 However, the supplied patch does I think achieve anything - it checks
 {{{$_post->ancestors}}} which can only be meaning full if we enter the
 {{{if}}} it is the {{{else if}}} for.

 Think this needs some more thought - probably a good idea to have some
 tests around this functionality.

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

More information about the wp-trac mailing list