WP_REST_Comments_Controller::check_edit_permission( object $comment )

Checks if a comment can be edited or deleted.


Description Description


Parameters Parameters

$comment

(object) (Required) Comment object.


Top ↑

Return Return

(bool) Whether the comment can be edited or deleted.


Top ↑

Source Source

File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

	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 );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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