I’d hazard a guess that it isn’t possible — at least not in this exact way — because of that default: return false;
part of the code you reference: a custom value of the comment status will hit that and the function will stop immediately.
However, have you thought about using a comment metavalue to store the same data? You could:
- Set the value: Set a custom meta on the offending comment, say
pluginname_comment_hide
, totrue
(I like removing negatives from values — e.g.hide
is clearer thannodisplay
). - Don’t display the comment: This is trickier but I believe you could adjust the
meta_query
value in theparse_comment_query
filter inWP_Comment_Query
to remove the offending comments. (This might affect that back-end as well, so you’d want to do it conditionally.) You could also use the callbacks args onwp_list_comments()
but you’d end up with comment counts that are off.
I don’t know if that’s too complex for an answer — let me know if more information would be helpful.