Opened 6 years ago
Closed 5 years ago
#46006 closed defect (bug) (wontfix)
comment_form() function doesn't call `comment_form_after_fields` action if fields was set to empty array
Reported by: | Guss77 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4.3 |
Component: | Comments | Keywords: | |
Focuses: | Cc: |
Description
This is apparently since WordPress 4.4 - before that, if you called:
commend_form([ 'fields' => [] ]);
Then the process for not logged in users would be:
comment_form_before_fields
action- for each field in
fields
(if any):comment_form_field_<name>
filter
comment_form_after_fields
action
In 4.4 this changed to be:
- for each field in
fields
(if any):- if the field is
"comment"
-comment_form_field_comment
filter - otherwise, and if user is not logged in:
- if its the first field -
comment_form_before_fields
comment_form_field_<name>
filter- if its the last field -
comment_form_after_fields
- if its the first field -
- if the field is
it is easy to see that if the theme designer decided not to use any standard field (maybe because she wants to do something crazy, or generate the standard field in comment_form_before_fields
or comment_form_after_fields
action), then their actions would not be called.
This is still an issue in 5.0
Change History (1)
Note: See
TracTickets for help on using
tickets.
Looks like this behavior was broken in [35723], which introduced the
comment_form_fields
filter. The fact that that change was 3.5 years ago and this is the only report of it being a problem makes me not want to adjust the behavior of the hooks at this point.The proper way to modify the default comment fields now would be to use the
comment_form_fields
filter. If done that way to insert other different fields, then the other two hooks would fire. It doesn't make sense to fire a_fields_before
or_fields_after
hook if there are no fields.As such, I'm going to close this as a
wontfix
. Feel free to respond if you disagree and we can continue the discussion.