[wp-hackers] Comment Abstraction

Doug Stewart dstewart at atl.lmco.com
Fri Jan 13 14:25:32 GMT 2006

Owen Winkler wrote:
> While working on a project recently, I noticed that although there are 
> many functions for abstracting post fetching from queries, there are 
> none for doing this with comments.
> For example, functions like get_posts() let you fetch a set of posts. An 
> entire class, WP_Query, has features for retrieving posts without a 
> developer having to write any SQL.  And in among those functions and 
> classes there are a dozen plugin hooks for altering what they return.
> Conversely, comment retrieval is primarily accomplished using SQL 
> queries.  As such, hooks for modifying what they return would need to be 
> inserted wherever a query was executed.
> The method for retrieving comments using a template's comments.php is 
> not so transparent, either.  A variable, $comments, simply shows up out 
> of seemingly nowhere to provide the comments for a post.
> My suggestion as a core enhancement for 2.next is to provide abstraction 
> functions and a first-pass set of plugin hooks to filter comments.
> Anyone else have opinions on this?
> Owen

+1, head-slappingly necessary code.

Doug Stewart
Systems Administrator/Web Applications Developer
Lockheed Martin Advanced Technology Labs
dstewart at atl.lmco.com

More information about the wp-hackers mailing list