Uses
Uses | Description |
---|---|
wp-includes/capabilities.php: current_user_can() | Returns whether the current user has the specified capability. |
wp-includes/user.php: get_current_user_id() | Get the current user’s ID |
Checks if a comment can be edited or deleted.
(WP_Comment) (Required) Comment object.
(bool) Whether the comment can be edited or deleted.
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 ); }
Version | Description |
---|---|
4.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_comments_controller/check_edit_permission