[wp-trac] [WordPress Trac] #40073: WP_Comment_Query should support a comment type of "comment"

WordPress Trac noreply at wordpress.org
Mon Mar 13 16:18:08 UTC 2017


#40073: WP_Comment_Query should support a comment type of "comment"
-------------------------+-----------------------------
 Reporter:  rogerlos     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Comments     |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+-----------------------------

Comment (by rogerlos):

 Thanks for looking at this.

 I agree that throwing an exception is the least desirable solution, and
 that passing a flag is probably the most flexible and backwards-
 compatible.

 I also agree we should let people set their comment types to 'comment' or
 'all' or 'pings' if that's what they want to do, as long as it's
 documented somewhere how to get them back.

 Naming parameters and variables is something I'm awful at, so I'm
 confident there is a better name for the flag which might actually even
 tell a user what it does just by reading the var name.

 One thing I did not note about `get_comments`:

 Even when the `type` parameter failed, I expected `type__in` to NOT fail,
 as I assumed it would be "literal", ie, outside of whatever magic was
 happening that caused `type` to fail. I think my line of reasoning was "if
 someone is going to specifically generate an array of types, surely the
 class will take them all literally".

 I have no basis for that other than my own prejudices, but it might also
 be a way forward if a flag is decided against. Seeing as there are only
 two magic types, plus a choice which returns everything, it seems unlikely
 a user sending `type__in` would want anything other than literal types.

 Finally, if `WP_Comment_Query` is modified, I suggest WP consider that
 core start setting a comment type when saving (how about "comment"!).

 There are a number of interesting things which can be done by saving
 appropriate content as "comments" even when they're not actual comments
 (for example, gaining access to spam checks, flood prevention, etc), and
 having no type by default can make it difficult to work within the data
 saved in the table.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40073#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list