[wp-trac] [WordPress Trac] #62066: Weird ability to modify comments to be empty
WordPress Trac
noreply at wordpress.org
Wed Sep 18 00:09:12 UTC 2024
#62066: Weird ability to modify comments to be empty
-------------------------------+-------------------------------------------
Reporter: lbones | Owner: Lela Bones
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 6.6.2
Severity: minor | Keywords: needs-patch changes-requested
Focuses: |
-------------------------------+-------------------------------------------
When I was viewing [this](https://core.trac.wordpress.org/ticket/61244)
ticket, I originally misinterpreted the issue. I thought that the user
wanted to avoid exporting comments that have no content, but I realized
that isn't actually allowed through the WordPress editor.
However, I was trying to recreate the empty comment issue, and realized
that users are able to edit comments to be empty.
I did some initial digging and [this file](https://github.com/WordPress
/wordpress-develop/blob/trunk/src/wp-includes/rest-api/endpoints/class-wp-
rest-comments-controller.php#L424) has a create_item that contains this
check:
{{{
// Do not allow comments to be created with a non-default
type.
if ( ! empty( $request['type'] ) && 'comment' !==
$request['type'] ) {
return new WP_Error(
'rest_invalid_comment_type',
__( 'Cannot create a comment with that
type.' ),
array( 'status' => 400 )
);
}
}}}
and an update_item() function. I think that adding this or something
similar to the the update_item function would resolve this issue.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62066>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list