WP_REST_Comments_Controller::check_edit_permission( WP_Comment $comment ): bool

In this article

Checks if a comment can be edited or deleted.

Parameters

$commentWP_Commentrequired
Comment object.

Return

bool Whether the comment can be edited or deleted.

Source

protected function check_edit_permission( $comment ) {
	if ( 0 === (int) get_current_user_id() ) {
		return false;
	}

	if ( current_user_can( 'moderate_comments' ) ) {
		return true;
	}

	return current_user_can( 'edit_comment', $comment->comment_ID );
}

Changelog

VersionDescription
4.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.