[wp-hackers] Filtering by comment_type

Peter Westwood peter.westwood at ftwr.co.uk
Fri Aug 21 16:56:50 UTC 2009


On 21 Aug 2009, at 17:11, Mohammad Jangda wrote:
> 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.
>

get_comments normally returns approved or pending comments

If you set the comment_approved on your comments to something else as  
well as having a different comment_type then they should never appear  
on the front end.

Of course you then won't be able to use get_comments to fetch them  
from the database as it doesn't support that type of query

-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5



More information about the wp-hackers mailing list