[wp-trac] [WordPress Trac] #64049: REST API: Updating comment via REST does not respect allow_empty_comment filter

WordPress Trac noreply at wordpress.org
Mon Sep 29 20:40:10 UTC 2025


#64049: REST API: Updating comment via REST does not respect allow_empty_comment
filter
--------------------------+------------------------------
 Reporter:  kadamwhite    |       Owner:  kadamwhite
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  rest-api
--------------------------+------------------------------
Description changed by kadamwhite:

Old description:

> When updating a comment via the REST API we currently fail comment
> updates in the `WP_REST_Comments_Controller::update_item` method if the
> updated content is `empty()`. On REST comment creation and within
> traditional comment updates via `wp_handle_comment_submission` we respect
> the return value of the `allow_empty_comment` filter and permit empty
> comment content when this filter is set.
>
> My understanding of the history here is that allowing empty comments
> permits moderation by allowing inappropriate comment content to be
> deleted without removing the content entity itself; or alternatively (and
> as discussed in #43177) to permit comments to be saved which only contain
> metadata and do not have any "content" in the traditional sense.
>
> This may also unblock certain actions for editorial comments within the
> block editor.

New description:

 When updating a comment via the REST API we currently fail comment updates
 in the `WP_REST_Comments_Controller::update_item` method if the updated
 content is `empty()`. On REST comment creation and within traditional
 comment updates via `wp_handle_comment_submission` we respect the return
 value of the `allow_empty_comment` filter and permit empty comment content
 when this filter is set.

 My understanding of the history here (see #62684) is that allowing
 comments to be edited to become empty permits moderation by allowing
 inappropriate comment content to be deleted without removing the content
 entity itself; or alternatively (and as discussed in #43177) to permit
 comments to be saved which only contain metadata and do not have any
 "content" in the traditional sense.

 This may also unblock certain actions for editorial comments within the
 block editor.

--

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


More information about the wp-trac mailing list