[wp-hackers] Filtering by comment_type
otto at ottodestruct.com
Tue Aug 25 13:26:51 UTC 2009
When you're displaying comments for a post, use wp_list_comments with
the type parameter set to 'comment' or 'custom_comment_type' or
anything else you want.
If you are going to do this on every post for the site, you can
optimize a bit and pre-separate the comments by changing your call to
comments_template to this:
comments_template( '/comments.php', true );
Sent from Memphis, TN, United States
On Fri, Aug 21, 2009 at 11:11 AM, Mohammad Jangda<batmoo at gmail.com> wrote:
> 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?
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers