[wp-trac] Re: [WordPress Trac] #7956: get_comment_link() should be paged comments aware

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 5 07:40:31 GMT 2008


#7956: get_comment_link() should be paged comments aware
--------------------------+-------------------------------------------------
 Reporter:  Viper007Bond  |        Owner:          
     Type:  defect        |       Status:  reopened
 Priority:  high          |    Milestone:  2.7     
Component:  Comments      |      Version:  2.7     
 Severity:  normal        |   Resolution:          
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by Viper007Bond):

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

Comment:

 `get_comment_link()` is now queryless for inside of the default comment
 loop due to the above changeset.

 However I'm still considering how to further optimize it for outside of
 the comment loop (i.e. recent comments widget) or for themes that use a
 callback parameter for `wp_list_comments()` but no `$page` parameter when
 they call `get_comment_link()`.

 Now that `get_comments()` caches, it could potentially be better than that
 changeset which still results in one query per call always. With
 `get_comments()`, you'd only query if you hadn't queried for that
 comment's parent post before.

 Example of "Latest 10 Comments":

 Current as of [9522]: 10 queries
 With `get_comments()`: Between 1 (all comments on the same post) and 10
 (all comments on different posts) queries

 Mark pointed out that `get_comments()` is a heavy query and that one query
 is not always better than more than one query (`get_page_of_comment()`'s
 current query is fairly light).

 I guess we'll need to do some trials.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7956#comment:21>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list