WP_REST_Comments_Controller::check_edit_permission() protected WP 4.7.0
Checks if a comment can be edited or deleted.
{} It's a method of the class: WP_REST_Comments_Controller{}
No Hooks.
Return
true/false. Whether the comment can be edited or deleted.
Usage
// protected - for code of main (parent) or child class $result = $this->check_edit_permission( $comment );
- $comment(WP_Comment) (required)
- Comment object.
Changelog
Since 4.7.0 | Introduced. |
Code of WP_REST_Comments_Controller::check_edit_permission() WP REST Comments Controller::check edit permission WP 5.6
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 );
}