Support » Plugin: User Role Editor » Why there's no 'edit_comment' capability?

Viewing 1 replies (of 1 total)
  • Plugin Author Vladimir Garagulia

    (@shinephp)

    ‘edit_comment’ is a virtual meta capability which finally is converted to ‘edit_post’ related one, like ‘edit_posts’ or ‘edit_others_posts’. Look at wp-includes/capabilities map_meta_cap() function:

    case 'edit_comment':
    		$comment = get_comment( $args[0] );
    		if ( ! $comment ) {
    			$caps[] = 'do_not_allow';
    			break;
    		}
    
    		$post = get_post( $comment->comment_post_ID );
    
    		/*
    		 * If the post doesn't exist, we have an orphaned comment.
    		 * Fall back to the edit_posts capability, instead.
    		 */
    		if ( $post ) {
    			$caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
    		} else {
    			$caps = map_meta_cap( 'edit_posts', $user_id );
    		}
    		break;

Viewing 1 replies (of 1 total)
  • The topic ‘Why there's no 'edit_comment' capability?’ is closed to new replies.