[wp-trac] [WordPress Trac] #55470: Allow for finer-grained callbacks for wp_list_comment

WordPress Trac noreply at wordpress.org
Sun Mar 27 17:48:01 UTC 2022


#55470: Allow for finer-grained callbacks for wp_list_comment
-------------------------+-----------------------------
 Reporter:  dshanske     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Comments     |    Version:  2.7
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 I've implemented a variety of different custom comment types, so
 logically, I'd like to allow for default customized comment output for
 these different types and still allow a theoretical theme to provide its
 own callback.

 Unfortunately, the only two options are a custom callback or a custom
 Comment Walker. Using the 'wp_list_comments_args' filter to make a custom
 comment walker the default, and reimplementing the start_el option is the
 only way to do this...but this means again, the possibility of
 unanticipated interaction.

 So, in thinking about this, proposing two enhancement options...looking
 for thoughts before I write up some code for consideration.

 1. Enhance the callback argument in wp_list_comments. Allow it to be an
 associative array or a string. If an associative array, the key would be
 comment_type. It would allow the 'all' parameter key, which would mean
 that the 'all' callback would be used if nothing more specific was
 provided. If this is a string, it would just set that to the all parameter
 and use the same logic. This would allow differing callbacks to be called
 per comment...if you choose to display them mixed.
 1. Add a filter inside start_el to allow for greater logic at this point
 before triggering the built-in or custom callback on a per-comment basis.

 Now, ideally, the solutions would be found in #35214 with some form of
 comment registration, but as that would have to be backward compatible,
 and that it has been 6 years since that conversation started suggests this
 simpler solution may make sense in the interim and even afterward.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55470>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list