[wp-hackers] Comment Abstraction

Owen Winkler ringmaster at midnightcircus.com
Fri Jan 13 13:48:13 GMT 2006


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



More information about the wp-hackers mailing list