[wp-hackers] Hooking into Comments

Dougal Campbell dougal at gunters.org
Thu Aug 25 18:30:16 GMT 2005

David House wrote:
> On 25/08/05, ml_wordpress at copperleaf.org <ml_wordpress at copperleaf.org> wrote:
>>So you took the approach of not inserting a post at all and just used a
>>ghost post id. In my case I was going to actually use the post record
>>(title, content, etc) but just not display it in the normal fashion.
>>Changing the status to a new type did not prevent it from showing up. I
>>had to modify the query with the post_where filter and add a ' AND
>>post_status != 'mystatus'. That makes me nervous.
> Future-date the post. WordPress will ignore any posts with dates in the future.

I was about to suggest something similar: associate the comments with a 
'draft' post or page, then just never publish it.

Another possibility: The comment_post_id field is a signed integer. 
Associate them with a negative post_id. If you have unique numeric 
identifiers for the pictures and galleries, this even gives you an easy 
way to connect the comments to them.

However, I wouldn't rely on this to keep working in the future versions, 
because I'm about to post a bug about the field type mismatch between 
posts.ID and comments.comment_post_ID :)

Your best bet is probably to associate with an unpublished post, and use 
the comment_karma field to track the comment's "real" parent.

Dougal Campbell <dougal at gunters.org>

More information about the wp-hackers mailing list