[wp-hackers] Filtering by comment_type

Mohammad Jangda batmoo at gmail.com
Fri Aug 21 16:11:21 UTC 2009


Apologies if this ends up as a duplicate post; My first post (through Google
Groups) didn't seem to go through.

---

I'm working on a plugin to enable editorial comments for Posts on the admin
side. I'm hoping to store these as regular comments and differentiate them
from regular comments using the comment_type field. The problem I'm running
into is how to hide these comments from the frontend, since WordPress by
default shows any and all comments
attached to a post. The get_comments function also doesn't allow you to
specify comment_type as an argument.

I found the following filter which I suppose I could use to loop through
remove any comments with a specific type from the array. But I don't see
that as being a very elegant solution.

$wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID
);

Any other suggestions? And does anyone forsee any issues with the way I'm
doing things?

Thanks.


More information about the wp-hackers mailing list